京セラプログラミングコンテスト2022(AtCoder Beginner Contest 271)
G
Access Counter
AtCoder
⌀ 2323
原题
← Ex→
翻译中…

Problem Statement

翻译中…

Takahashi has decided to put a web counter on his webpage. The accesses to his webpage are described as follows:

翻译中…
  • For $i=0,1,2,\ldots,23$, there is a possible access at $i$ o'clock every day:
  • If $c_i=$T, Takahashi accesses the webpage with a probability of $X$ percent.
    • If $c_i=$A, Aoki accesses the webpage with a probability of $Y$ percent.
    • Whether or not Takahashi or Aoki accesses the webpage is determined independently every time.
  • There is no other access.
翻译中…

Also, Takahashi believes it is preferable that the $N$-th access since the counter is put is not made by Takahashi himself.

翻译中…

If Takahashi puts the counter right before $0$ o'clock of one day, find the probability, modulo $998244353$, that the $N$-th access is made by Aoki.

翻译中…

Note

翻译中…

We can prove that the sought probability is always a finite rational number. Moreover, under the constraints of this problem, when the value is represented as $\frac{P}{Q}$ with two coprime integers $P$ and $Q$, we can prove that there is a unique integer $R$ such that $R \times Q \equiv P\pmod{998244353}$ and $0 \leq R \lt 998244353$. Find this $R$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^{18}$
  • $1 \leq X,Y \leq 99$
  • $c_i$ is T or A.
  • $N$, $X$, and $Y$ are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N X Y
c_0 c_1 \ldots c_{23}

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
1 50 50
ATATATATATATATATATATATAT
Output #1
665496236
The $1$-st access since Takahashi puts the web counter is made by Aoki with a probability of $\frac{2}{3}$.
Input #2
271 95 1
TTTTTTTTTTTTTTTTTTTTTTTT
Output #2
0
There is no access by Aoki.
Input #3
10000000000000000 62 20
ATAATTATATTTAAAATATTATAT
Output #3
744124544
题目信息
题号
abc271_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。