#726
Unrated
Moo Decomposition
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

You have a long string SS of Ms and Os and an integer K1K \geq 1. Count the number of ways of ways to decompose SS into subsequences such that each subsequence is MOOOO....O with exactly KK Os, modulo 109+710^9+7.

Since the string is very long, you are not given it explicitly. Instead, you are given an integer LL (1L10181 \leq L \leq 10^{18}), and a string TT of length NN (1N1061 \leq N \leq 10^6). The string SS is the concatenation of LL copies of the string TT.

입력

The first line contains KK, NN, and LL.

The second line contains the string TT of length NN. Every character is either an M or an O.

It is guaranteed that the number of decompositions of SS is nonzero.

출력

Output the number of decompositions of string SS, modulo 109+710^9+7.

예제 입력 1

2 6 1
MOOMOO

예제 출력 1

1

예제 입력 2

2 6 1
MMOOOO

예제 출력 2

6

예제 입력 3

1 4 2
MMOO

예제 출력 3

4

예제 입력 4

1 4 100
MMOO

예제 출력 4

976371285

점수

Inputs 5-7: K=1K=1, L=1L = 1Inputs 8-10: K=2K=2, N1000N\leq 1000, L=1L = 1Inputs 11-13: K=1K=1Inputs 14-19: L=1L = 1Inputs 20-25: No additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.