#include #define int long long #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define per(i,a,b) for(int i=(a);i>=(b);i--) #define fi first #define se second #define eb emplace_back #define popc __builtin_popcount using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; typedef vector vp; typedef unsigned long long ull; typedef long double ld; int read() { int x=0,w=1; char c=getchar(); while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();} while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} return x*w; } const int N=(1<<18)+9,mod=998244353,inv2=(mod+1)/2; int n,a[N],w[N],q,t[N],tick; char s[N]; int ksm(int x,int y,int r=1) { for(;y;y>>=1,x=x*x%mod) if(y&1) r=r*x%mod; return r; } namespace BLT { int S,b[N],c[N],l[N],id[N],tot,bs; vi s[520]; void build(int p,int l,int r) { s[p].resize(bs); rep(x,0,bs-1) { s[p][x]=0; rep(j,l,r) c[j^x]=a[j]; rep(j,l,r) s[p][x]=(s[p][x]+c[j]*w[j-l+1])%mod; } } void bmdf(int p,int l,int r,int x,int y) { rep(z,0,bs-1) { int pos=z^x; s[p][z]=(s[p][z]+y*w[pos-l+1])%mod; } } pii bqry(int p,int l,int r,int x,int y,int z) { if(ry) return pii(0,0); else if(x<=l&&r<=y) return pii(r-l+1,s[p][z]); else { x=max(x,l), y=min(y,r); int cnt=0,res=0; rep(i,x,y) res=(res+a[i^z]*w[++cnt])%mod; return pii(cnt,res); } } void build(int n) { S=(1<y0) continue; x0^=z1*bs, y0^=z1*bs; auto [c,r]=bqry(p,l[p],l[p]+bs-1,x0,y0,z2); if(c) ans=(ans+w[cnt]*r)%mod, cnt+=c; } return ans; } } signed main() { scanf("%lld%s",&n,s); int lim=(1<