atcoder#ABC271G. [ABC271G] Access Counter

[ABC271G] Access Counter

Score : 600600 points

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.
  • 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 0 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.

1 50 50
ATATATATATATATATATATATAT
665496236

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

271 95 1
TTTTTTTTTTTTTTTTTTTTTTTT
0

There is no access by Aoki.

10000000000000000 62 20
ATAATTATATTTAAAATATTATAT
744124544