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;
#define int long long
const int MOD=998244353;

int N,ans,cnt;int X;
string x;

int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}

int f(int a){//長さaのループがX以下に何種類存在するか
  int res=0;
  for(int i=0;i<a;i++)if(x[i]=='1')res+=pw(2,a-i-1),res%=MOD;
  string s=x.substr(0,a);
  string t=s;
  for(int i=0;i<s.size();i++){
    if(t[i]=='0')t[i]='1';
    else t[i]='0';
  }
  string u;
  for(int i=0;u.size()<N;i++){
    if(i&1)u+=t;
    else u+=s;
  }
  for(int i=a;i<N;i++){
    if(x[i]=='1'&&u[i]=='0'){
      res++;break;
    }
    if(x[i]=='0'&&u[i]=='1'){
      break;
    }
    if(i==N-1)res++;
  }
  return res;
}

int INT(string x){
  int res=0;
  for(char p:x){
    res*=2;
    res+=p-'0';
    res%=MOD;
  }
  return res;
}

signed main(){
  cin>>N>>x;
  typedef pair<int,int> P;
  typedef pair<int,P> IP;
  vector<IP> v;
  for(int i=1;i<N;i++){
    if(N%i)continue;
    if((N/i)&1){
      int A=f(i);
      v.push_back(IP(i,P(A,0)));
      /*
      ans+=A*2*i%MOD;ans%=MOD;
      cnt+=A;
      cout<<A<<" "<<i<<endl;
      */
    }
  }
  for(int i=0;i<v.size();i++){
    IP p=v[i];
    int n=p.first,s=p.second.first,t=p.second.second;
    for(int j=i+1;j<v.size();j++){
      if(v[j].first%n==0){
        v[j].second.second+=s-t;
      }
    }
    ans+=(s-t)*2*n%MOD;ans%=MOD;
    cnt+=s-t;cnt%=MOD;
  }
  ans+=(INT(x)+1-cnt)%MOD*N*2%MOD;ans%=MOD;ans+=MOD;ans%=MOD;
  cout<<ans<<endl;
}
