#include <bits/stdc++.h>
using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1e9 + 7;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* ------問題------

-----問題ここまで----- */
/* -----解説等-----

----解説ここまで---- */

template <::std::uint_fast32_t MODULO> class modint {
public:
	using uint32 = ::std::uint_fast32_t; using uint64 = ::std::uint_fast64_t; using value_type = uint32; uint32 a; modint() noexcept : a(0) {}modint(const signed x) noexcept : a(x) {}modint(const long long x) noexcept : a(x%MODULO) {}modint(const uint32 x) noexcept : a(x) {}modint operator+(const modint &o) const noexcept { return a + o.a < MODULO ? modint(a + o.a) : modint(a + o.a - MODULO); }modint operator-(const modint &o) const noexcept { return modint(a < o.a ? a + MODULO - o.a : a - o.a); }modint operator*(const modint &o) const noexcept { return modint(static_cast<uint64>(a) * o.a % MODULO); }modint operator/(const modint &o) const { return modint(static_cast<uint64>(a) * (~o).a % MODULO); }modint &operator+=(const modint &o) noexcept { return *this = *this + o; }modint &operator-=(const modint &o) noexcept { return *this = *this - o; }modint &operator*=(const modint &o) noexcept { return *this = *this * o; }modint &operator/=(const modint &o) { return *this = *this / o; }modint operator~() const noexcept { return pow(MODULO - 2); }modint operator-() const noexcept { return a ? modint(MODULO - a) : *this; }modint operator++() noexcept { return a == MODULO - 1 ? a = 0 : ++a, *this; }modint operator--() noexcept { return a ? --a : a = MODULO - 1, *this; }bool operator==(const modint &o) const noexcept { return a == o.a; }bool operator!=(const modint &o) const noexcept { return a != o.a; }bool operator<(const modint &o) const noexcept { return a < o.a; }bool operator<=(const modint &o) const noexcept { return a <= o.a; }bool operator>(const modint &o) const noexcept { return a > o.a; }bool operator>=(const modint &o) const noexcept { return a >= o.a; }explicit operator bool() const noexcept { return a; }explicit operator uint32() const noexcept { return a; }modint pow(uint32 x) const noexcept { uint64 t = a, u = 1; while (x) { if (x & 1)u = u * t % MODULO; t = (t * t) % MODULO; x >>= 1; }	return modint(u); }
	uint32 get() const noexcept { return a; }
};
using mint = modint<MOD>;
const mint mintzero = mint(0); const mint mintone = mint(1);
mint modinv(mint a) { return mintone / mint(a); }

vector<mint> fact, inv_fact;

void init_fact(int n) {
	fact.resize(n);
	fact[0] = mintone;
	for (int i = 1; i < n; i++) {
		fact[i] = fact[i - 1] * mint(i);
	}
	inv_fact.resize(n);
	inv_fact[n - 1] = modinv(fact[n - 1]);
	for (int i = n - 2; i >= 0; i--) {
		inv_fact[i] = mint(i + 1) * inv_fact[i + 1];
	}
}
mint nCr(int n, int r) {
	if (n < r || n < 0 || r < 0) return mintzero;
	return fact[n] * inv_fact[r] * inv_fact[n - r];
}


mint f3(int A, int P, int bb, int k1 = -1) {
	int m = A + P;
	mint ans = 0;
	int s = P;
	int ppp = bb - k1;
	int q = A;
	if (q - bb < s && q - s >k1) {
		mint ret = nCr(m, s);
		{
			int b = k1;
			int c = q - s;
			int sig = -1;
			while (true) {
				int nc = b * 2 - c;
				int nx = (m - nc) / 2;
				if (nx > m)break;
				ret += (sig > 0 ? nCr(m, nx) : -nCr(m, nx));
				sig = -sig;
				c = nc;
				b -= ppp;
			}
		}
		{
			int b = bb;
			int c = q - s;
			int sig = -1;
			while (true) {
				int nc = b * 2 - c;
				int nx = (m - nc) / 2;
				if (nx < 0)break;
				ret += (sig > 0 ? nCr(m, nx) : -nCr(m, nx));
				sig = -sig;
				c = nc;
				b += ppp;
			}
		}
		ans += ret;
	}

	return ans;
}
mint f(int n, int k) {
	mint ret = 0;

	FOR(h, 0, n + 1) {
		if (h - k <= n - h)// 見落としがち
			ret += f3(h, n - h, k + 1, -10000)*mint(2).pow(h);
	}
	return ret;
}

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	init_fact(2e6 + 6);
	int N; cin >> N;
	string s; cin >> s;

	mint ans = f(N, SZ(s)) - f(N, SZ(s) - 1);
	ans /= mint(2).pow(SZ(s));
	cout << ans.get() << endl;


	//dp[0][0] = 1;

	//FOR(i, 0, N) {
	//	FOR(j, 0, N) {
	//		dp[i + 1][j + 1] += dp[i][j] * 2;
	//		dp[i + 1][max(0, j - 1)] += dp[i][j];
	//	}
	//}
	//mint ans = dp[N][SZ(s)];
	//ans /= mint(2).pow(SZ(s));
	//cout << ans.get() << endl;


	return 0;
}

Measured memory_bytes: 31488