Universal Cup Judging System

Universal Cup

実行時間制限: 5.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓
統計

Yana, Mino, White, and Huzz are best friends.

Mino has been feeling confused lately. Obsessed with his past failures in OI, he has been struggling to plan his future while managing his busy school schedule. His three friends suggested he evaluate the importance of his tasks and prioritize them.

Assume there are $n$ different tasks numbered from $1$ to $n$. Each time, Huzz selects two adjacent tasks, White compares them, and Yana merges them into a single task. Mino is surprised to find that this process accidentally forms a segment tree, which does not necessarily split in the middle. More precisely, it forms a tree with $2n - 1$ nodes, where every subtree corresponds to a contiguous segment. Note that all $n$ tasks are leaves, while the other $n - 1$ nodes each have two children. These nodes, which result from comparisons, define the values of the edges to their children: $0$ for the smaller one and $1$ for the larger one.

Mino is very fond of calculations. He defines the weight of each task as the XOR sum of the edges along the path from the task to the root. He wonders: if the weights are given, how many ways are there to construct such trees and compare the children?

Once again, Mino is not skilled in OI, which is why he has turned to you for help. To simplify the problem, you only need to find the answer modulo $998,244,353$.

Input

The first line of the input contains a positive integer $n$ ($1 \le n \le 250000$), the number of tasks.

The second line contains a binary string $S$ of length $n$, where $S_i$ represents the Bitwise-XOR of all values on the edges from task $i$ to the root.

Output

Print an integer, the answer modulo $998,244,353$.

Example

input

4
0101

output

6

Note

There are $6$ ways to construct the tree and compare the children:

Figure 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.