#agc051d. [agc051_d]C4

[agc051_d]C4

Problem Statement

In the following undirected graph, count the number of walks from SS to SS that pass through the edges STST, TUTU, UVUV, VSVS (in any direction) exactly aa, bb, cc, dd times, respectively, modulo 998,244,353998,244,353.

Notes

A walk from SS to SS is a sequence of vertices v0=S,v1,ldots,vk=Sv_0 = S, v_1, \\ldots, v_k = S such that for each i(0leqi<k)i (0 \\leq i < k), there is an edge between viv_i and vi+1v_{i+1}. Two walks are considered distinct if they are distinct as sequences.

Constraints

  • 1leqa,b,c,dleq500,0001 \\leq a, b, c, d \\leq 500,000
  • All values in the input are integers.

Input

Input is given from Standard Input in the following format:

aa bb cc dd

Output

Print the answer.


Sample Input 1

2 2 2 2

Sample Output 1

10

There are 1010 walks that satisfy the condition. One example of such a walk is SS rightarrow\\rightarrow TT rightarrow\\rightarrow UU rightarrow\\rightarrow VV rightarrow\\rightarrow UU rightarrow\\rightarrow TT rightarrow\\rightarrow SS rightarrow\\rightarrow VV rightarrow\\rightarrow SS.


Sample Input 2

1 2 3 4

Sample Output 2

0

Sample Input 3

470000 480000 490000 500000

Sample Output 3

712808431