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 <cstdio>

typedef long long LL;
const int Mod = 998244353;
const int MN = 200005;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

bool ip[MN];
int p[MN], pc;
int mu[MN];

inline void Sieve(int N) {
	mu[1] = 1;
	for (int i = 2; i <= N; ++i) {
		if (!ip[i]) p[++pc] = i, mu[i] = -1;
		for (int j = 1, k; j <= pc; ++j) {
			if ((k = p[j] * i) > N) break;
			ip[k] = 1;
			if (i % p[j]) mu[k] = -mu[i];
			else break;
		}
	}
}

int N, A[MN], B[MN], Ans;

inline int Calc(int x) {
	static int C[MN];
	int Cnt = 0;
	for (int i = 1; i <= x; ++i) C[i] = A[i], Cnt = (2ll * Cnt + C[i]) % Mod;
	for (int j = 2; j <= N / x; ++j)
		for (int i = 1; i <= x; ++i)
			C[(j - 1) * x + i] = C[i] ^ (~j & 1);
	int ok = 1;
	for (int i = 1; i <= N; ++i) {
		if (C[i] == A[i]) continue;
		if (C[i] > A[i]) { ok = 0; break; }
		if (C[i] < A[i]) break;
	}
	if (ok) Cnt = (Cnt + 1) % Mod;
	return Cnt;
}

int stk[MN], tp;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%1d", &A[i]);
	Sieve(N);
	for (int i = 1; i <= N; ++i) {
		if (N % i != 0 || N / i % 2 == 0) continue;
		stk[++tp] = i;
		B[i] = Calc(i);
	}
	for (int i = tp; i >= 1; --i) {
		int x = stk[i], Sum = 0;
		for (int j = 1; j <= tp; ++j) {
			int y = stk[j];
			if (x % y != 0 || !mu[x / y]) continue;
			Sum = ((LL)Sum + mu[x / y] * B[y] + Mod) % Mod;
		}
		B[x] = Sum;
	}
	for (int i = 1; i <= tp; ++i) Ans = (Ans + (LL)B[stk[i]] * stk[i]) % Mod;
	printf("%lld\n", 2ll * Ans % Mod);
	return 0;
}