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>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

vector<UL> Divs(UL a, UL p = 2) {
	if (a == 1) return { 1 };
	for (; a % p != 0; p++) if (p * p > a) return { 1, a };
	UL n = 1;
	for (; a % p == 0; n++) a /= p;
	vector<UL> buf = Divs(a, p + 1 | 1);
	UL i = buf.size(), l = buf.size();
	buf.resize(i * n);
	for (; i < buf.size(); i++) buf[i] = buf[i - l] * p;
	return buf;
}

const ULL M = 998244353;

ULL F(const string& a, UL s) {
	bool less = false;
	for (UL i = 0; i < a.size() - s; i++) {
		if (a[i] != a[i + s]) continue;
		less = a[i] == '0';
		break;
	}
	ULL tmp = 0;
	rep(i, s) {
		tmp <<= 1;
		tmp += a[i] - '0';
		if (tmp >= M) tmp -= M;
	}
	if (!less) tmp = (tmp + 1) % M;
	return tmp;
}

struct Problem {

	void Solve() {
		UL N; cin >> N;
		vector<UL> D = Divs(N);
		sort(D.begin(), D.end());
		string S; cin >> S;
		rep(i, N) S.push_back('0' + '1' - S[i]);

		vector<ULL> V(D.size());
		rep(i, D.size()) {
			UL d = D[i];
			if (N / d % 2 == 0) continue;
			ULL f = F(S, d);
			V[i] += f;
			V[i] %= M;
			for (UL j = i + 1; j < D.size(); j++) {
				if (D[j] % d == 0) {
					V[j] += (M - V[i]);
				}
			}
		}
		ULL ans = 0;
		rep(i, D.size()) {
			ans += (ULL)D[i] * V[i];
			ans %= M;
		}
		ans = ans * 2 % M;
		cout << ans << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}
