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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static final long MODULO = 998244353;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String x = in.next();
            long xval = 0;
            for (int i = 0; i < n; ++i) {
                xval = (xval * 2 + (x.charAt(i) - '0')) % MODULO;
            }
            int[] len = new int[n];
            int[] what = new int[n];
            int am = 0;
            int cur = x.charAt(0) - '0';
            int cnt = 1;
            for (int i = 1; i < n; ++i) {
                if (x.charAt(i) - '0' == cur) {
                    ++cnt;
                } else {
                    len[am] = cnt;
                    what[am] = cur;
                    ++am;
                    cur = x.charAt(i) - '0';
                    cnt = 1;
                }
            }
            len[am] = cnt;
            what[am] = cur;
            ++am;
            long cval = 0;
            int pblock = 0;
            long[] ways = new long[n + 1];
            for (int k = n - (1 - n % 2); k >= 1; k -= 2) {
                if (n % k == 0) {
                    int block = n / k;
                    if (pblock > block) throw new RuntimeException();
                    while (pblock < block) {
                        cval = (cval * 2 + (x.charAt(pblock) - '0')) % MODULO;
                        ++pblock;
                    }
                    int extra = 1;
                    for (int i = 0; i + block < n; ++i) {
                        int e = 1 - (x.charAt(i) - '0');
                        int a = x.charAt(i + block) - '0';
                        if (e < a) {
                            break;
                        }
                        if (e > a) {
                            extra = 0;
                            break;
                        }
                    }
                    ways[k] = (cval + extra) % MODULO;
                    for (int j = 3 * k; j < ways.length; j += 2 * k) {
                        ways[k] -= ways[j];
                        if (ways[k] < 0) ways[k] += MODULO;
                    }
                }
            }
            long res = 0;
            for (int i = 1; i < ways.length; i += 2)
                if (ways[i] != 0) {
                    res += ways[i] * 2 * (n / i);
                    res %= MODULO;
                }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

