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>
#include <iostream>
#include <cstring>

using namespace std;


const int MOD = 998244353;

int sum(int a, int b)
{
    a += b;
    if (a >= MOD) a -= MOD;
    return a;
}
int sub(int a, int b)
{
    a -= b;
    if (a < 0) a += MOD;
    return a;
}
int mult(int a, int b)
{
    return (a * 1LL * b) % MOD;
}

const int N = 2e5 + 5;

int n;
char s[N];
int x[N];
int num[N];

int g[N];

void calc(int k)
{
    if (!((n / k) & 1))
        return;

    g[k] = sum(g[k], num[k]);
    for (int i = 0; i < n; ++i)
    {
        int cur = x[i % k] ^ ((i / k) & 1);
        if (cur < x[i])
            break;
        if (cur > x[i])
            return;
    }
    g[k] = sum(g[k], 1);
}

int main()
{
    //freopen("input.txt", "r", stdin);


    scanf("%d%s", &n, s);
    int m = strlen(s);

    for (int i = 0; i < n - m; ++i)
        x[i] = 0;
    for (int i = n - m; i < n; ++i)
        x[i] = s[i - (n - m)] - '0';

    num[0] = 0;
    for (int i = 0; i < n; ++i)
        num[i + 1] = sum(mult(2, num[i]), x[i]);

    for (int k = 1; k * k <= n; ++k)
    {
        if (n % k) continue;
        calc(k);
        if (k * k != n)
            calc(n / k);
    }

    for (int i = 1; i <= n; ++i)
        for (int j = i + i; j <= n; j += i)
        {
            if (n % j == 0 && ((n / j) & 1))
                g[j] = sub(g[j], g[i]);
        }

    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = sum(ans, mult(2 * i, g[i]));
    printf("%d", ans);

}
