Mercurialist

시간 제한2초메모리 제한1024 MB

요약
엘릭서, 수은, 요구르트 병을 매일 무작위로 마실 때 수은의 기한을 고려해 앨리스가 영원히 살 확률을 구한다.
난이도

어려움10점 중 8점

유형
확률, 조합론, 동적 계획법, 수학
정답자
아직 제출이 없습니다

문제

This country has a medicine for immortality. Alice got X+Y+ZX + Y + Z bottles from the Hatter.

XX bottles contain elixir. If Alice drinks it, she will immediately become immortal.

YY bottles contain mercury, and each has a different toxicity. If she drinks the ii-th bottle, the following event ii will occur after K+i−0.5K + i - 0.5 days.

  • Event ii: Alice will immediately die if she has not drunk the elixir before event ii. If she has drunk the elixir, she won't die.

The remaining ZZ bottles contain yogurt. Nothing will happen when Alice drinks it.

At the same time every morning, Alice chooses one non-empty bottle with equal probability and drinks it. If all bottles are empty, she does nothing.

Answer the probability that Alice will be alive 10101010^{10^10} days after the first day she starts drinking bottles. Note that Alice won't die other than events.

The probability can be expressed as PQ\frac{P}{Q} using coprime integers PP and QQ. Output a non-negative integer RR less than 998244353998244353 such that R×Q≡P(mod998244353)R \times Q \equiv P \pmod {998244353}. It can be proven that the probability is a rational number, and RR is uniquely determined under the conditions of this problem.

입력

XX YY ZZ KK

출력

Output RR defined in the statement. Add a new line at the end of the output.

제한

  • All inputs consist of integers.
  • 1≤X,Y,Z,K≤1051 \le X, Y, Z, K \le 10^5

힌트

In Sample Input 1, Alice will only die if she drinks mercury on day 1 and yogurt on day 2. The probability of death is 1/3×1/2=1/61/3 \times 1/2 = 1/6, therefore the answer is 5/65/6.

In Sample Input 2, Alice never dies.

예제4

  1. 예제 1

    입력
    1 1 1 1
    
    예상 출력
    831870295
    
  2. 예제 2

    입력
    1 1 1 100
    
    예상 출력
    1
    
  3. 예제 3

    입력
    2 2 1 2
    
    예상 출력
    565671801
    
  4. 예제 4

    입력
    12912 83717 73177 1920
    
    예상 출력
    685360162