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 <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <stdlib.h>
using namespace std;
typedef long long int lld;
typedef long double ld;
const lld mod = 998244353;
lld dp[222222],vis[222222];
bool can(string a,string b){
	for(int e=0;e<a.size();e++){
		if(a[e]>b[e]) return true;
		if(a[e]<b[e]) return false;
	}
	return true;
}
int main(void){
	lld n;
	string a;
	cin >> n >> a;
	dp[0] = 1;
	for(int e=1;e<222222;e++) dp[e] = (dp[e-1]*2)%mod;
	lld ans = 0;
	for(int e=0;e<n;e++) if(a[e]=='1') ans = (ans+dp[n-e-1]*n*2)%mod;
	ans = (ans+2*n)%mod;
	vector<lld> v;
	for(int e=1;e<n;e++) if(n%e==0&&(n/e)%2) v.push_back((lld)e);
	for(int e=0;e<v.size();e++){
		lld val = 0;
		for(int p=0;p<v[e];p++) if(a[p]=='1') val = (val+dp[v[e]-p-1])%mod;
		string f = "",s="",t="";
		for(int p=0;p<v[e];p++) f += a[p];
		for(int p=0;p<v[e];p++){
			if(a[p]=='1') s += "0";
			else s += "1";
		}
		for(int p=0;p<n/v[e];p++){
			if(p%2==0) t += f;
			else t += s;
		}
		if(can(a,t)) val = (val+1)%mod;
		val = (val-vis[v[e]]+mod*mod)%mod;
		ans = (ans - 2*val*n + 2*val*v[e]+mod*mod)%mod;
		for(int p=v[e];p<=n;p+=(v[e]*2)) vis[p] = (vis[p]+val)%mod;
	}
	printf("%lld",ans);
	return 0;
}