Given are integers N and X. For each integer k between 0 and X (inclusive), find the answer to the following question, then compute the sum of all those answers, modulo 998244353.

* Let us repeat the following operation on the integer k. Operation: if the integer is currently odd, subtract 1 from it and divide it by 2; otherwise, divide it by 2 and add 2^{N-1} to it. How many operations need to be performed until k returns to its original value? (The answer is considered to be 0 if k never returns to its original value.)

Constraints

* 1 \leq N \leq 2\times 10^5
* 0 \leq X < 2^N
* X is given in binary and has exactly N digits. (In case X has less than N digits, it is given with leading zeroes.)
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
X


Output

Print the sum of the answers to the questions for the integers between 0 and X (inclusive), modulo 998244353.

Examples

Input

3
111


Output

40


Input

6
110101


Output

616


Input

30
001110011011011101010111011100


Output

549320998
#include<bits/stdc++.h>
using namespace std;
const int N=4e5+5,mod=998244353;
typedef long long ll;
int n;
ll f[N];
char s[N];
vector<int>v;
int main()
{
    scanf("%d",&n);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) s[i+n]='1';
    for(int i=1;i*i<=2*n;i++)
        if(2*n%i==0)
    {
        if(i&1)
            v.push_back(i);
        if(2*n/i!=i&&(2*n/i&1)) v.push_back(2*n/i);
    }
    for(int l=0;l<v.size();l++)
    {
        int k=2*n/v[l],t=k/2;
        string a="";
        for(int i=1;i<=t;i++) f[k]=((f[k]<<1)+s[i]-'0')%mod,a+=s[i];
        bool flag=true;
        for(int j=t;j+t<=2*n;j+=t)
        {
            for(int i=0;i<a.size();i++)
                if(a[i]=='1') a[i]='0';
            else a[i]='1';
            string b="";
            for(int h=1;h<=t;h++) b+=s[j+h];
            if(b<a){flag=false;break;}
            if(b>a) break;
        }
        f[k]+=flag;
    }
    ll ans=0;
    for(int i=2;i<=2*n;i++)
        if(f[i])
    {
        for(int j=2;j*j<=i;j++)
            if(i%j==0)
        {
            f[i]=(f[i]-f[j])%mod;
            if(i/j!=j) f[i]=(f[i]-f[i/j])%mod;
        }
        ans=(ans+f[i]*i)%mod;
    }
    ans=(ans+mod)%mod;
    printf("%lld\n",ans);
}
