This sample code is also a solution to the problem at the following URL of atcoder. * https://atcoder.jp/contests/abc178/tasks/abc178_b
The code receive input parameters formatted as below from stdin.
1 2 1 1
3 5 -4 -2
-1000000000 0 -1000000000 0
and so on.
Also, the code can receive very big integer values. If you are using Integer instead of BigInt, you will not receive the exact big integer value.
Also, Integer and BigInt must not be combined in an operation because the result will be inaccurate. Finally, use BigInt.toString() to return or output value.