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 R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;
const int N = 410000, mod = 998244353;

int n, g[N], f[N], ans;
char s[N], tmp[N];

template <class T>
inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
    while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

inline int addMod(int a, int b) {
    return (a += b) >= mod ? a - mod : a;
}

inline int check(int len) {
    int t = 2 * n / len;
    for (R int i = 0; i < t; ++i) {
        for (R int j = 1; j <= (len >> 1); ++j) tmp[i * len + j] = s[j];
        for (R int j = (len >> 1) + 1; j <= len; ++j) tmp[i * len + j] = s[j - (len >> 1)] ^ 1;
    }
    for (R int i = 1; i <= 2 * n; ++i) {
        if (s[i] < tmp[i]) return 0;
        if (s[i] > tmp[i]) return 1;
    }
    return 1;
}

int main() {
    read(n), scanf("%s", s + 1);
    for (R int i = 1; i <= n; ++i) s[i + n] = s[i] ^ 1;
    for (R int i = 1; i <= n; ++i) {
        f[i] = addMod(f[i - 1], f[i - 1]);
        if (s[i] == '1') f[i] = addMod(f[i], 1);
    }
    for (R int i = 2; i <= 2 * n; i += 2) {
        if (n % i == 0 || 2 * n % i != 0) continue;
        g[i >> 1] = addMod(f[i >> 1], check(i));
        for (R int j = 2; j < i; j += 2)
            if (i % j == 0) g[i >> 1] = addMod(g[i >> 1], mod - g[j >> 1]);
        ans = (ans + (ll) i * g[i >> 1]) % mod;
    }
    cout << ans << endl;
    return 0;
}