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;

long long n,ans,mod=998244353ll,tmp,pos,cont,pot[200005];
int v[200005];
vector<pair<long long,long long> > opz;
vector<long long> divi;
string x,zer,s;

int calc(int siz){
	
	s.clear();
	
	for(int i=0;i<siz;i++){
		s.push_back(x[i]);
	}
	
	while(s.size()<x.size())s.push_back('0'+(s[s.size()%siz]-'0')^int((s.size()/siz)%2==1));
	
	if(s<=x)return n+1;
	
	for(int j=siz-1;j>=0;j--){
		if(x[j]=='1')return j;
	}
	
	return -1;
}

int main(){
	
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin>>n>>zer;
	
	pot[0]=1;
	
	for(int i=1;i<200005;i++)pot[i]=(pot[i-1]*2ll)%mod;
	
	for(int i=0;i<(n-zer.size());i++)x.push_back('0');
	
	for(int i=0;i<zer.size();i++)
	x.push_back(zer[i]);
	
	for(int i=1;i<=n;i++){
		if(n%i==0 && (n/i)%2==1)divi.push_back(i);
	}
	
	for(int i=0;i<divi.size();i++){
		
		//cout<<divi[i]<<endl;
		cont=divi[i];
		tmp=0;
		
		zer.clear();
		for(int j=0;j<x.size();j++)zer.push_back('0');
		
		pos=calc(divi[i]);
		
		if(pos==-1)continue;
		
		for(int j=0;j<divi[i];j++){
			cont--;
			if(j<pos){
				if(x[j]=='1')
				tmp+=pot[cont];
			}
			else{
				if(j>pos)tmp+=pot[cont];
			}
			
			tmp%=mod;
		}
		
		tmp++;
		//cout<<divi[i]<<" ha "<<tmp<<" numeri"<<endl;
		opz.push_back({tmp,divi[i]});
	}
	
	
	for(int i=0;i<opz.size();i++){
		for(int j=i-1;j>=0;j--){
			if(opz[i].second%opz[j].second==0){
				opz[i].first-=opz[j].first;
				opz[i].first%=mod;
			}
		}
		
		ans+=(opz[i].first*(opz[i].second*2ll%mod))%mod;
		ans%=mod;
	}
	
	cout<<(ans%mod+mod)%mod<<"\n";

return 0;
}
