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 <string>
#include <vector>
using namespace std;

string S; int N;
long long power[200009], dp[200009], mod = 998244353;

void init() {
	power[0] = 1;
	for (int i = 1; i <= 200000; i++) power[i] = (2LL * power[i - 1]) % mod;
}

long long find_value(long long K) {
	string V1 = S.substr(0, S.size() / K);
	string V2 = V1; for (int i = 0; i < V2.size(); i++) { if (V2[i] == '0') V2[i] = '1'; else V2[i] = '0'; }

	string V = "";
	for (int i = 0; i < K; i++) {
		if (i % 2 == 0) V += V1;
		else V += V2;
	}

	long long val = 0;
	for (int i = 0; i < V1.size(); i++) {
		if (V1[i] == '1') val += power[V1.size() - 1 - i];
		val %= mod;
	}

	if (V <= S) return (val + 1LL) % mod;
	return val;
}

int main() {
	cin >> N >> S; init();

	vector<long long> R;
	for (int i = 1; i <= N; i += 2) {
		if (N%i != 0) continue;
		R.push_back(i);
	}

	for (int i = (int)R.size() - 1; i >= 0; i--) {
		dp[i] = find_value(R[i]);
		for (int j = i + 1; j < (int)R.size(); j++) {
			if (R[j] % R[i] == 0) { dp[i] -= dp[j]; dp[i] += mod; dp[i] %= mod; }
		}
	}

	long long ans = 0;
	for (int i = 0; i < R.size(); i++) {
		long long c1 = ((2LL * N) / R[i]);
		long long c2 = dp[i];
		ans += c1 * c2;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}