#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#define ll long long
#define sl(n) scanf("%lld", &n)
#define ss(n) scanf("%s", n)
#define sch(n) scanf("%c", &n)
#define sf(n) scanf("%lf", &n)
#define PI 2*acos(0.0)
#define INF (1LL<<62)
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second
#define srt(v) sort(v.begin(), v.end())
using namespace std;
char s[20];
ll len;
ll dp[17][17];
ll solve(ll rowLeft, ll pos) {
if (pos == len - 1) {
return 1;
}
ll &ret = dp[rowLeft][pos];
if (ret != -1) return ret;
ret = 0;
ret += solve(rowLeft, pos + 1);
if (rowLeft > 1) {
ret += solve(rowLeft - 1, pos + 1);
}
// cout << rowLeft << " " << pos << " " << ret << endl;
return ret;
}
int main() {
ll n;
sl(n);
ss(s);
len = strlen(s);
ll ans = 0;
if (n - len > 0) {
ans += (1LL << (len-1));
ans *= n - len;
}
// cout << ans << endl;
memset(dp, -1, sizeof(dp));
ll rowLeft = min(n, len);
while (rowLeft) {
ans += solve(rowLeft--, 0);
}
printf("%lld\n", ans);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CgovLyNwcmFnbWEgR0NDIG9wdGltaXplKCJPZmFzdCIpCi8vI3ByYWdtYSBHQ0MgdGFyZ2V0KCJhdngsYXZ4MixmbWEiKQovLyNwcmFnbWEgR0NDIG9wdGltaXphdGlvbiAoInVucm9sbC1sb29wcyIpCgojZGVmaW5lIGxsIGxvbmcgbG9uZwoKI2RlZmluZSBzbChuKSBzY2FuZigiJWxsZCIsICZuKQojZGVmaW5lIHNzKG4pIHNjYW5mKCIlcyIsIG4pCiNkZWZpbmUgc2NoKG4pIHNjYW5mKCIlYyIsICZuKQojZGVmaW5lIHNmKG4pIHNjYW5mKCIlbGYiLCAmbikKCiNkZWZpbmUgUEkgMiphY29zKDAuMCkKI2RlZmluZSBJTkYgKDFMTD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