#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x,T a,T b){return a<=x&&x<=b;}
template<class T> void amin(T &a,T v){if(a>v) a=v;}
template<class T> void amax(T &a,T v){if(a<v) a=v;}
int ROUND(double x) { return (int)(x+0.5); }
bool ISINT(double x) { return fabs(ROUND(x)-x)<=EPS; }
bool ISEQUAL(double x,double y) { return fabs(x-y)<=EPS*max(1.0,max(fabs(x),fabs(y))); }
double SQSUM(double x,double y) { return x*x+y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



#if 1

ll dp[5005][5005];

ll extgcd(ll a, ll b, ll& x, ll& y)
{
	ll d = a;
	if (b != 0)
	{
		d = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	else
	{
		x = 1;
		y = 0;
	}
	return d;
}

// 逆元を求める
ll mod_inverse(ll a, ll m)
{
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x%m) % m;
}

int main()
{
	int N;
	cin >> N;

	string s;
	cin >> s;

	const int L = SZ(s);
	const int MOD = 1e9 + 7;

	dp[0][0] = 1; // dp[ボタン押した回数][現在の文字の長さ]


	for (int key=0;key<N;key++)
	{
		for (int len = 0; len <= key; len++)
		{
			dp[key + 1][len + 1] += 2 *dp[key][len];
			dp[key + 1][len + 1] %= MOD;
			dp[key + 1][max(0, len - 1)] += dp[key][len];
			dp[key + 1][max(0, len - 1)] %= MOD;
		}
	}

	ll ans = dp[N][L];
	ll inv2 = mod_inverse(2, MOD);
	for (int i = 0; i < L; ++i)
	{
		ans *= inv2;
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

#elif 1


ll dp[500][500];
ll mpow[500][500];

int main()
{
	const int MOD = 1e9 + 7;

	int N, C;
	cin >> N >> C;
	vector <int> A(N), B(N), x(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	for (int i = 0; i < N; ++i)
	{
		cin >> B[i];
	}
	



	for (int i = 0; i < N; i++)
	{
		for (int z = A[i]; z <= B[i]; ++z)
		{
			ll x = 1;
			for (int q = 0; q < 500; q++)
			{
				mpow[i][q] += x;
				mpow[i][q] %= MOD;
				x *= z;
				x %= MOD;
			}
		}
	}

	memset(dp, 0, sizeof(dp));

	dp[0][C] = 1; // dp[0-園児番号i][残りキャンディ]

	for (int i = 0; i < N; ++i)
	{
		for (int c = 0; c <= C; ++c)
		{
			for (int a = 0; a <= c; ++a)
			{
				dp[i + 1][c - a] += (dp[i][c] * mpow[i][a]) % MOD;
				dp[i + 1][c - a] %= MOD;
			}
		}
	}

	cout << dp[N][0] << endl;
	return 0;
}


#elif 1

int main()
{
	string s;
	cin >> s;

	const int N = SZ(s);
	for (char c = 'a'; c <= 'z'; ++c)
	{
		vector <int> sum(N + 1);
		for (int i = 0; i < N; ++i)
		{
			if (c == s[i])
			{
				sum[i + 1] = sum[i] + 1;
			}
			else
			{
				sum[i + 1] = sum[i];
			}
		}

		for (int len = 2; len <= min(100, N); ++len)
		{
			for (int i = 0; i + len <= N; ++i)
			{
				int freq = sum[i + len] - sum[i];
				if (freq > len / 2)
				{
					printf("%d %d\n", i + 1, i + len);
					return 0;
				}
			}
		}
	}
	printf("%d %d\n", -1, -1);
	return 0;
}


#else

int main()
{
	int N;
	cin >> N;
	vector <int> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
	}

	int bestDist = BIG;

	for (int y=-100;y<=100;++y)
	{
		int dist = 0;
		for (int x : a)
		{
			dist += SQ(x - y);
		}

		amin(bestDist, dist);
	}

	cout << bestDist << endl;

	return 0;
}

#endif

Measured memory_bytes: 116992