#ABC266G. [ABC266G] Yet Another RGB Sequence

[ABC266G] Yet Another RGB Sequence

Score : 600600 points

Problem Statement

You are given integers RR, GG, BB, and KK. How many strings SS consisting of R, G, and B satisfy all of the conditions below? Find the count modulo 998244353998244353.

  • The number of occurrences of R, G, and B in SS are RR, GG, and BB, respectively.
  • The number of occurrences of RG as (contiguous) substrings in SS is KK.

Constraints

  • 1R,G,B1061 \leq R,G,B\leq 10^6
  • 0Kmin(R,G)0 \leq K \leq \mathrm{min}(R,G)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

RR GG BB KK

Output

Print the answer.

2 1 1 1
6

The following six strings satisfy the conditions.

  • RRGB
  • RGRB
  • RGBR
  • RBRG
  • BRRG
  • BRGR
1000000 1000000 1000000 1000000
80957240

Find the count modulo 998244353998244353.