7353: ABC275 —— B - ABC-DEF
[Creator : ]
Description
There are non-negative integers A, B, C, D, E, and F, which satisfy $A\times B\times C\geq D\times E\times F$.
Find the remainder when $(A\times B\times C)-(D\times E\times F)$ is divided by 998244353.
Find the remainder when $(A\times B\times C)-(D\times E\times F)$ is divided by 998244353.
Input
The input is given from Standard Input in the following format:
$A\ B\ C\ D\ E\ F$
$A\ B\ C\ D\ E\ F$
Output
Print the remainder when $(A\times B\times C)-(D\times E\times F)$ is divided by 998244353, as an integer.
Constraints
$0≤A,B,C,D,E,F≤10^{18}$
$A\times B\times C\geq D\times E\times F$
A, B, C, D, E, and F are integers.
$A\times B\times C\geq D\times E\times F$
A, B, C, D, E, and F are integers.
Sample 1 Input
2 3 5 1 2 4
Sample 1 Output
22
Since $A\times B\times C=2\times 3\times 5=30$ and $D\times E\times F=1\times 2\times 4$,
we have $(A\times B\times C)-(D\times E\times F)=22$. Divide this by 998244353 and print the remainder, which is 22.
we have $(A\times B\times C)-(D\times E\times F)=22$. Divide this by 998244353 and print the remainder, which is 22.
Sample 2 Input
1 1 1000000000 0 0 0
Sample 2 Output
1755647
Since $A\times B\times C=1000000000$ and $D\times E\times F=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.
we have $(A\times B\times C)-(D\times E\times F)=1000000000$. Divide this by 998244353 and print the remainder, which is 1755647.
Sample 3 Input
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000
Sample 3 Output
0
We have $(A\times B\times C)-(D\times E\times F)=0$. Divide this by 998244353 and print the remainder, which is 0.