#include #include #include #include #include #include #include #define maxn 100007 #define grantN 1000007 #define modp 1000000007 #define mmmp 9973 #define eps (5E-1) #define minf2 (1E-10) #define lim1 30 #define lim2 300 using namespace std; typedef long long LL; const double PI=4*atan(1); const double PI2=PI*2; int n,m,tot; LL gg,jj; typedef struct sege { int b,e; //struct sege *nxt; friend int operator<(struct sege x, struct sege y) { return x.b>=1; } return res; } void extgcd(int a, int b, int &x, int &y) { if (b != 0) { extgcd(b, a % b, y, x); y -= (a / b) * x; } else { x = 1; y = 0; } } int mod_inv(int a, int p) { int x, y; extgcd(a, p, x, y); return (p + x % p) % p; } int invm(int x, int p) { x%=p; if (x==0) return 0; else return mod_inv(x,p); } int crt(int x, int m1, int y, int m2) { if (y>x) return ((y-x)%m2*invm(m1,m2)%m2*m1%m2+x)%m2; else return ((x-y)%m1*invm(m2,m1)%m1*m2%m1+y)%m1; } char s[maxn]; int f[maxn],fi[maxn]; int main() { int T; LL N; //scanf("%d",&T); //T=1; srand(time(0)); while (scanf("%d",&n)!=EOF) //printf("%d\n",strcmp("aaa","aaa")); //while (T--) //for (int ci=1;ci<=T;++ci) { scanf("%s",s); f[0]=fi[0]=1; m=strlen(s); for (int i=0;i