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 math
import sys
input = sys.stdin.readline

N = int(input())
X = input()
mod = 998244353


def calc_div_odd(N):
    div_odd = []
    for i in range(1, math.floor(N ** (1/2)) + 1):
        if N % i == 0:
            if i % 2 == 1:
                div_odd.append(i)
            if N // i != i:
                if (N // i) % 2 == 1:
                    div_odd.append(N//i)
    return div_odd


def main():
    block_num_list = calc_div_odd(N)
    block_num_list.sort()
    ok_num = {x: 0 for x in block_num_list}
    use_num = {x: 0 for x in block_num_list}
    div_dict = {x: [] for x in block_num_list}
    for block_num in block_num_list:
        block_len = N // block_num
        X_ref = X[:block_len]
        ok_num[block_num] += int(X_ref, 2) % mod
        X_ref_inv = ''
        for i in range(block_len):
            x = '0' if X_ref[i] == '1' else '1'
            X_ref_inv += x
        Y = (X_ref + X_ref_inv) * (block_num // 2) + X_ref
        flg = 1
        for x, y in zip(X, Y):
            if x == '1' and y == '0':
                break
            elif x == '0' and y == '1':
                flg = 0
                break
        if flg:
            ok_num[block_num] += 1

        # if int(X, 2) >= int((X_ref + X_ref_inv) * (block_num // 2) + X_ref, 2):
            # ok_num[block_num] += 1

        div_d_list = calc_div_odd(block_num)
        for div_d in div_d_list:
            if div_d != block_num:
                div_dict[block_num].append(div_d)

    ans = 0
    for block_num in reversed(block_num_list):
        block_len = N // block_num
        div_list = div_dict[block_num]
        use_num[block_num] = (use_num[block_num] + ok_num[block_num]) % mod
        for div in div_list:
            use_num[div] = (use_num[div] - use_num[block_num]) % mod
        ans = (ans + ((block_len * 2) * use_num[block_num])) % mod

    print(ans)


if __name__ == '__main__':
    main()
