QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#6211. Bitwise Operation

Statistiques

JYY has recently been studying bitwise operations. He found that the most interesting bitwise operation is the XOR operation. For the XOR of two numbers, JYY discovered a conclusion: the XOR value of two numbers is 0 if and only if they are equal. JYY then began to wonder, what properties does the XOR value of $N$ numbers have?

JYY wants to know how many ways there are to choose $N$ distinct integers in the range $[0, R-1]$ such that the XOR sum of these $N$ integers is 0. (Different orders of selection are not counted as distinct; please refer to the examples.)

JYY is a computer scientist, so the $R$ in his mind is extremely large. For convenience, if we write $R$ as a 0-1 string, $R$ is obtained by repeating a shorter 0-1 string $S$, $K$ times. For example, if $S = \text{"101"}$ and $K = 2$, then the binary representation of $R$ is $\text{"101101"}$.

Since the result of the calculation can be very large, JYY only needs you to tell him the total number of ways modulo $10^9+7$.

Input

The first line contains two positive integers $N$ and $K$.

The next line contains a string $S$ consisting of 0s and 1s.

It is guaranteed that the first character of $S$ is 1.

Output

Output a single integer representing the number of ways to choose the integers, modulo $10^9+7$.

Examples

Input 1

3 1
100

Output 1

1

Note

For the first example, the only way to choose the integers is $\{1, 2, 3\}$.

Input 2

5 100
1

Output 2

598192244

Constraints

Test Case $N$ $K$ $ S $
1 $N = 3$ $K = 1$ $ S = 10$
2 $N = 3$ $K = 10000$ $1 \le S \le 50$
3, 4, 5 $N = 5$ $1 \le K \le 20$ $1 \le S \le 50$
6 $N = 4$ $1 \le K \le 10^4$ $1 \le S \le 50$
7, 8, 9, 10 $3 \le N \le 7$ $1 \le K \le 10^5$ $1 \le S \le 50$

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.