#abc271g. G - Access Counter

G - Access Counter

Score : 600600 points

问题陈述

高桥决定在他的网页上放置一个网页计数器。
访问他网页的情况如下:

  • 对于 i=0,1,2,,23i=0,1,2,\ldots,23,每天的 ii 点钟都有可能进行访问:
    • 如果 ci=c_i=T,高桥访问该网页的概率为 XX%。
    • 如果 ci=c_i=A,青木访问该网页的概率为 YY%。
    • 高桥或青木是否访问网页在每次都是独立决定的。
  • 没有其他访问来源。

另外,高桥认为自从放置计数器以来,第 NN 次访问最好是不由他自己发起的。

如果高桥在某天 恰好在 0 点前 放置计数器,请计算(模 998244353998244353)第 NN 次访问是由青木发起的概率。

以上为通义千问 qwen-max 翻译,仅供参考。

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,,23i=0,1,2,\ldots,23, there is a possible access at ii o'clock every day:
    • If ci=c_i=T, Takahashi accesses the webpage with a probability of XX percent.
    • If ci=c_i=A, Aoki accesses the webpage with a probability of YY 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 NN-th access since the counter is put is not made by Takahashi himself.

If Takahashi puts the counter right before 00 o'clock of one day, find the probability, modulo 998244353998244353, that the NN-th access is made by Aoki.

Notes

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 PQ\frac{P}{Q} with two coprime integers PP and QQ, we can prove that there is a unique integer RR such that R×QP(mod998244353)R \times Q \equiv P\pmod{998244353} and 0R<9982443530 \leq R \lt 998244353. Find this RR.

Constraints

  • 1N10181 \leq N \leq 10^{18}
  • 1X,Y991 \leq X,Y \leq 99
  • cic_i is T or A.
  • NN, XX, and YY are integers.

Input

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

NN XX YY

c0c1c23c_0 c_1 \ldots c_{23}

Output

Print the answer.

Sample Input 1

1 50 50
ATATATATATATATATATATATAT

Sample Output 1

665496236

The 11-st access since Takahashi puts the web counter is made by Aoki with a probability of 23\frac{2}{3}.

Sample Input 2

271 95 1
TTTTTTTTTTTTTTTTTTTTTTTT

Sample Output 2

0

There is no access by Aoki.

Sample Input 3

10000000000000000 62 20
ATAATTATATTTAAAATATTATAT

Sample Output 3

744124544

update @ 2024/3/10 11:26:52

}