#include #include #include #include #include #include #include #include #include #include #include #define eps 1e-5 #define inf 0x3f3f3f3f #define Linf 0x3f3f3f3f3f3f3f3f #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define lson l,m,rt<<1 #define rson m+1,r,rt<<1 | 1 #define lc rt<<1 #define rc rt<<1 | 1 #define getx2(a) ((a)*(a)) #define Pi acos(-1.0) typedef long long LL; using namespace std; #define MM 76543 #define N 100010 #define mod 9973 struct node { int l,r; int ans; node() { ans=1; } } Tree[4*N]; char a[N]; int num; void PushUp(int rt) { Tree[rt].ans=(Tree[lc].ans*Tree[rc].ans%mod+mod)%mod; } void Build(int l,int r,int rt) { Tree[rt].l=l,Tree[rt].r=r; if(l==r) { Tree[rt].ans=(int)(a[num]-28)%mod; num++; return ; } int m=(l+r)>>1; Build(lson); Build(rson); PushUp(rt); } int Query(int L,int R,int rt) { if(L<=Tree[rt].l&&Tree[rt].r<=R) { return Tree[rt].ans; } int m=(Tree[rt].l+Tree[rt].r)>>1; int ans=1; if(L<=m)ans=(ans*Query(L,R,lc)%mod+mod)%mod; if(R>m)ans=(ans*Query(L,R,rc)%mod+mod)%mod; return ans; } int main() { int n; while(~scanf("%d",&n)) { memset(a,'\0',sizeof(a)); scanf("%s",a+1); int len=strlen(a+1); num=1; Build(1,len,1); for(int i=0;i