Problem Statement
There are non-negative integers A, B, C, D, E, and F, which satisfy AtimesBtimesCgeqDtimesEtimesF.
Find the remainder when (AtimesBtimesC)−(DtimesEtimesF) is divided by 998244353.
Constraints
- 0leqA,B,C,D,E,Fleq1018
- AtimesBtimesCgeqDtimesEtimesF
- A, B, C, D, E, and F are integers.
The input is given from Standard Input in the following format:
A B C D E F
Output
Print the remainder when (AtimesBtimesC)−(DtimesEtimesF) is divided by 998244353, as an integer.
2 3 5 1 2 4
Sample Output 1
22
Since AtimesBtimesC=2times3times5=30 and DtimesEtimesF=1times2times4=8,
we have (AtimesBtimesC)−(DtimesEtimesF)=22. Divide this by 998244353 and print the remainder, which is 22.
1 1 1000000000 0 0 0
Sample Output 2
1755647
Since AtimesBtimesC=1000000000 and DtimesEtimesF=0,
we have $(A\\times B\\times C)-(D\\times E\\times F)=1000000000$. Divide this by 998244353 and print the remainder, which is 1755647.
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000
Sample Output 3
0
We have (AtimesBtimesC)−(DtimesEtimesF)=0. Divide this by 998244353 and print the remainder, which is 0.