#include <bits/stdc++.h>

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxM = 5e3 + 10;
const ll mod = 1e9 + 7;

int n, m;
char s[maxM];
ll fact[1000010], ifact[1000010];

ll power(ll a, ll b)
{
    ll r = 1;
    while (b)
    {
        if (b & 1)
        {
            r = r * a % mod;
        }
        b /= 2;
        a = a * a % mod;
    }
    return r;
}

void init()
{
    fact[0] = 1;
    for (int i = 1; i <= 1e6; ++i)
    {
        fact[i] = fact[i - 1] * i % mod;
    }
    ifact[1000000] = power(fact[1000000], mod - 2);
    for (int i = 999999; i >= 0; --i)
    {
        ifact[i] = ifact[i + 1] * (i + 1) % mod;
    }
}

ll nCk(int n, int k)
{
    if (k < 0 || k > n)
    {
        return 0;
    }
    return fact[n] * ifact[k] % mod * ifact[n - k] % mod;
}

ll catalan(int n)
{
    return fact[n * 2] * ifact[n + 1] % mod * ifact[n] % mod;
}

void add_self(ll &x, ll y)
{
    x = (x + y) % mod;
}

namespace firstSub
{
    const int maxN = 3e2 + 10;
    const int maxM = 3e2 + 10;

    ll dp[maxN][maxM];

    void solve()
    {
        dp[0][0] = 1;
        //corner cases
        for1(i, n)
        {
            for (int j = 0; j <= i - j; j++)
            {
                add_self(dp[i][0], (nCk(i, j) - nCk(i, j - 1) + mod) % mod * power(2, j) % mod);
            }
        }
        for1(j, m)
        {
            for1(i, n)
            {
                add_self(dp[i][j], dp[i - 1][j - 1]);
                for (int k = 2; k <= i; k += 2)
                {
                    add_self(dp[i][j], dp[i - k][j] * catalan(k / 2 - 1) % mod * power(2, k / 2) % mod);
                }
            }
        }
        cout << dp[n][m];
    }
}

namespace fullSub
{
    const int maxN = 5e3 + 10;

    ll dp[maxN][maxN];

    void solve()
    {
        dp[0][0] = 1;
        for1(i, n)
        {
            fore(j, 0, i)
            {
                if (j + 1 <= i - 1)
                {
                    //delete
                    add_self(dp[i][j], dp[i - 1][j + 1]);
                }
                if (j >= 1)
                {
                    //insert
                    add_self(dp[i][j], dp[i - 1][j - 1] * 2 % mod);
                }
                if (j == 0)
                {
                    //delete
                    add_self(dp[i][j], dp[i - 1][j]);
                }
            }
        }
        cout << dp[n][m] * power(power(2, mod - 2), m) % mod;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    init();
    cin >> n >> (s + 1);
    m = strlen(s + 1);
    if (n <= 3e2)
    {
        firstSub::solve();
    }
    else
    {
        fullSub::solve();
    }
    return 0;
}


Measured memory_bytes: 135928