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 fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int mo = 998244353;

ll ksm(ll x, ll y) {
	ll s = 1;
	for(; y; y /= 2, x = x * x % mo)
		if(y & 1) s = s * x % mo;
	return s;
}

const int N = 2e5 + 5;

int n;
char s[N];
int a[N];
ll ans, sum, a2[N];
ll cnt[N], f[N];
int w[N], w0;

int main() {
	//freopen("a.in", "r", stdin);
	scanf("%d", &n);
	a2[0] = 1; fo(i, 1, n) a2[i] = a2[i - 1] * 2 % mo;
	scanf("%s", s + 1);
	reverse(s + 1, s + n + 1);
	fo(i, 1, n) a[i] = s[i] - '0';
	sum = 1;
	fo(i, 1, n) sum = (sum + a2[i - 1] * a[i]) % mo;
	ans = sum * 2 * n % mo;
	fo(d, 1, n - 1) if(n % d == 0 && (n / d % 2 == 1)) {
		w[++ w0] = d;
		ll ps = 0;
		fo(j, n - d + 1, n) ps = (ps + a2[j - (n - d + 1)] * a[j]) % mo;
		cnt[d] += ps;
		int ky = -1;
		fd(i, n / d - 2, 0) {
			fd(j, d, 1) {
				int x = a[n - d + j], y = a[i * d + j];
				if((n / d - 1 - i) % 2 == 1) x = !x;
				if(x < y) { ky = 1; break;}
				if(x > y) { ky = 0; break;}
			}
			if(ky != -1) break;
		}
		if(ky != 0) cnt[d] ++;
	}
	fo(i, 1, w0) {
		int x = w[i];
		f[x] = cnt[x];
		fo(j, 1, i - 1) if(x % w[j] == 0 && x / w[j] % 2 == 1)
			f[x] -= f[w[j]];
		ans -= (ll) (2 * n - 2 * x) * f[x];
	}
	ans = (ans % mo + mo) % mo;
	pp("%lld\n", ans);
}