#abc289h. Ex - Trio

Ex - Trio

Score : 600600 points

问题陈述

在数轴上有三个人:第1个人、第2个人和第3个人。初始时刻(时间t=0t=0),第1个人位于点AA,第2个人位于点BB,第3个人位于点CC。其中,AABBCC均为整数,并且满足ABC(mod2)A \equiv B \equiv C \pmod{2}

在时间t=0t=0时,这三个人开始随机漫步。具体来说,在某一时刻tttt为非负整数)位于点xx的人,在时刻t+1t+1时以相同的概率移动到点(x1)(x-1)或点(x+1)(x+1)。(所有移动的选择都是随机且相互独立的。)

求在时间TT时,三人首次同时到达同一位置的概率对998244353998244353取模的结果。

什么是模998244353998244353下的有理数?我们可以证明所求概率始终是一个有理数。而且,在本题的约束条件下,当该值表示为两个互质整数PPQQ的比值PQ\frac{P}{Q}时,可以证明存在一个唯一的整数RR,使得R×QP(mod998244353)R \times Q \equiv P\pmod{998244353}0R<9982443530 \leq R < 998244353。请找出这样的RR

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

Problem Statement

On a number line are person 11, person 22, and person 33. At time 00, person 11 is at point AA, person 22 is at point BB, and person 33 is at point CC.
Here, AA, BB, and CC are all integers, and ABC(mod2)A \equiv B \equiv C \pmod{2}.

At time 00, the three people start random walks. Specifically, a person that is at point xx at time tt (tt is a non-negative integer) moves to point (x1)(x-1) or point (x+1)(x+1) at time (t+1)(t+1) with equal probability. (All choices of moves are random and independent.)

Find the probability, modulo 998244353998244353, that it is at time TT that the three people are at the same point for the first time.

What is rational number modulo 998244353998244353? We can prove that the sought probability is always a rational number. Moreover, under the Constraints of this problem, when the value is represented as PQ\frac{P}{Q} by 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 such RR.

Constraints

  • 0A,B,C,T1050 \leq A, B, C, T \leq 10^5
  • ABC(mod2)A \equiv B \equiv C \pmod{2}
  • A,B,CA, B, C, and TT are integers.

Input

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

AA BB CC TT

Output

Find the probability, modulo 998244353998244353, that it is at time TT that the three people are at the same point for the first time, and print the answer.

Sample Input 1

1 1 3 1

Sample Output 1

873463809

The three people are at the same point for the first time at time 11 with the probability 18\frac{1}{8}. Since 873463809×81(mod998244353)873463809 \times 8 \equiv 1 \pmod{998244353}, 873463809873463809 should be printed.

Sample Input 2

0 0 0 0

Sample Output 2

1

The three people may already be at the same point at time 00.

Sample Input 3

0 2 8 9

Sample Output 3

744570476

Sample Input 4

47717 21993 74147 76720

Sample Output 4

844927176

update @ 2024/3/10 12:06:03