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>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 998244353;
const int maxn = 1e6 + 233;
int p[maxn],u[maxn],vis[maxn],cnt=0;
void init(){
	memset(vis,0,sizeof(vis));
	int n = 1e6;
	u[1] = 1;
	for(int i=2;i<=n;i++){
		if(!vis[i]){p[++cnt] = i;u[i] = -1;}
		for(int j=1;j<=cnt&&i*p[j]<=n;j++){
			if(i%p[j]==0){
				u[i*p[j]] = 0;
				vis[i*p[j]] = 1;
				break;
			}
			else{
				u[i*p[j]] = -u[i];
				vis[i*p[j]] = 1; 
			} 
		}
	}
//	for(int i=1;i<=30;i++)
//		cout<<i<<": "<<u[i]<<" "<<vis[i]<<endl;
	return ;
}
char s[maxn];
int a[maxn];
ll f[maxn];
ll ans = 0;
int main()
{
 	ios::sync_with_stdio(false);
	int n;cin>>n;
	cin>>s;
	for(int i=0;i<n;i++)a[i] = s[i]-'0';
//	for(int i=0;i<n;i++)cout<<a[i];cout<<endl;
	for(int x=1;x<=2*n;x++)
		if((2*n)%x==0&&n%x){
			ll sum = 0,cur = 0;
			bool bad = 0;
			for(int i=0;i<x/2;i++)
				cur = (cur*2+a[i])%mod;
			sum = cur;
			for(int i=0;i<n;i++){
				int t = a[i%(x/2)];
				if((i%x)>=x/2)t ^= 1;
//				cout<<"->"<<i<<" "<<a[i]<<" "<<t<<endl;
				if(t<a[i])break;
				if(t>a[i])bad = 1;
			}
			if(!bad)sum++;
//			cout<<"!"<<x<<" "<<sum<<endl;
			f[x] = (f[x]+sum+mod)%mod;
			ans = (ans+1LL*f[x]*x%mod)%mod;
			for(int i=x+x;i<=2*n;i+=x)
				f[i] = (f[i]+mod-f[x])%mod;
		}
//	for(int x=1;x<=2*n;x++)
//		if((2*n)%x==0&&n%x)
//			ans = (ans+f[x]*x)%mod;
	cout << ans << endl;
	return 0;
}
