The presidential election is coming in Bearland next year! Everybody is so excited about this!

So far, there are three candidates, Alice, Bob, and Charlie. 

There are n citizens in Bearland. The election result will determine the life of all citizens of Bearland for many years. Because of this great responsibility, each of n citizens will choose one of six orders of preference between Alice, Bob and Charlie uniformly at random, independently from other voters.

The government of Bearland has devised a function to help determine the outcome of the election given the voters preferences. More specifically, the function is <image> (takes n boolean numbers and returns a boolean number). The function also obeys the following property: f(1 - x1, 1 - x2, ..., 1 - xn) = 1 - f(x1, x2, ..., xn).

Three rounds will be run between each pair of candidates: Alice and Bob, Bob and Charlie, Charlie and Alice. In each round, xi will be equal to 1, if i-th citizen prefers the first candidate to second in this round, and 0 otherwise. After this, y = f(x1, x2, ..., xn) will be calculated. If y = 1, the first candidate will be declared as winner in this round. If y = 0, the second will be the winner, respectively.

Define the probability that there is a candidate who won two rounds as p. p·6n is always an integer. Print the value of this integer modulo 109 + 7 = 1 000 000 007.

Input

The first line contains one integer n (1 ≤ n ≤ 20).

The next line contains a string of length 2n of zeros and ones, representing function f. Let bk(x) the k-th bit in binary representation of x, i-th (0-based) digit of this string shows the return value of f(b1(i), b2(i), ..., bn(i)).

It is guaranteed that f(1 - x1, 1 - x2, ..., 1 - xn) = 1 - f(x1, x2, ..., xn) for any values of x1, x2, ldots, xn.

Output

Output one integer — answer to the problem.

Examples

Input

3
01010101


Output

216


Input

3
01101001


Output

168

Note

In first sample, result is always fully determined by the first voter. In other words, f(x1, x2, x3) = x1. Thus, any no matter what happens, there will be a candidate who won two rounds (more specifically, the candidate who is at the top of voter 1's preference list), so p = 1, and we print 1·63 = 216.
#include <bits/stdc++.h>
using namespace std;
int pct(int x) { return __builtin_popcount(x); }
int pct(long long x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); }
int bt(long long x) { return 63 - __builtin_clzll(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
long long cdiv(long long a, long long b) {
  return a / b + !(a < 0 || a % b == 0);
}
int nxt_C(int x) {
  int c = x & -x, r = x + c;
  return (((r ^ x) >> 2) / c) | r;
}
long long nxt_C(long long x) {
  long long c = x & -x, r = x + c;
  return (((r ^ x) >> 2) / c) | r;
}
vector<int> get_bits(int mask) {
  vector<int> bb;
  while (mask) {
    int b = bt(mask);
    bb.push_back(b);
    mask ^= (1 << b);
  }
  reverse(bb.begin(), bb.end());
  return bb;
}
int get_mask(vector<int> v) {
  int mask = 0;
  for (int x : v) {
    mask ^= (1 << x);
  }
  return mask;
}
template <typename T>
void uniq(vector<T> &v) {
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
void sc() {}
template <typename Head, typename... Tail>
void sc(Head &H, Tail &...T) {
  cin >> H;
  sc(T...);
}
const int mod = 1e9 + 7;
int pwr(int a, long long b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * 1LL * a) % mod;
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 1e6 + 5;
const int LOGN = 20;
const int NN = (1 << LOGN);
int f[NN], f1[NN];
void or_transform(int *from, int *to) {
  if (to - from == 1) return;
  int *mid = from + (to - from) / 2;
  or_transform(from, mid);
  or_transform(mid, to);
  for (int i = 0; i < mid - from; i++) {
    mid[i] += from[i];
    if (mid[i] >= mod) mid[i] -= mod;
  }
}
void or_inverse(int *from, int *to) {
  if (to - from == 1) return;
  int *mid = from + (to - from) / 2;
  or_inverse(from, mid);
  or_inverse(mid, to);
  for (int i = 0; i < mid - from; i++) {
    mid[i] += mod - from[i];
    if (mid[i] >= mod) mid[i] -= mod;
  }
}
void xor_transform(int *from, int *to) {
  if (to - from == 1) return;
  int *mid = from + (to - from) / 2;
  xor_transform(from, mid);
  xor_transform(mid, to);
  for (int i = 0; i < mid - from; i++) {
    int a = from[i];
    int b = mid[i];
    from[i] = a + b;
    mid[i] = a - b + mod;
    if (from[i] >= mod) from[i] -= mod;
    if (mid[i] >= mod) mid[i] -= mod;
  }
}
void xor_inverse(int *from, int *to) {
  xor_transform(from, to);
  int tot = to - from;
  long long iv = pwr(tot, mod - 2);
  for (int i = 0; i <= tot - 1; i++) {
    from[i] = (from[i] * iv) % mod;
  }
}
void and_transform(int *from, int *to) {
  reverse(from, to);
  or_transform(from, to);
  reverse(from, to);
}
void and_inverse(int *from, int *to) {
  reverse(from, to);
  or_inverse(from, to);
  reverse(from, to);
}
void solve() {
  int n;
  sc(n);
  int tot = (1 << n);
  for (int i = 0; i <= tot - 1; i++) {
    char ch;
    sc(ch);
    f[i] = ch - '0';
    f1[i] = f[i] ^ 1;
  }
  xor_transform(f, f + tot);
  xor_transform(f1, f1 + tot);
  for (int i = 0; i <= tot - 1; i++) {
    f[i] = (f[i] * 1LL * f1[i]) % mod;
  }
  xor_inverse(f, f + tot);
  for (int i = 0; i <= tot - 1; i++) {
    for (int j = 0; j <= n - 1; j++) {
      if ((i >> j) & 1) {
        f[i] = (f[i] * 2LL) % mod;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= tot - 1; i++) {
    ans += f[i];
    if (ans >= mod) ans -= mod;
  }
  ans = (ans * 3LL) % mod;
  cout << ans;
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int tt = 1; tt <= t; tt++) {
    solve();
  }
  return 0;
}
