fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long int t, a, b, c, d, result;
  7. cin >> t;
  8. for (int i = 0; i < t; i++)
  9. {
  10. cin >> a >> b >> c >> d;
  11. result = (((a % 1000000007) * (b % 1000000007) % 1000000007) - ((c % 1000000007) * (d % 1000000007) % 1000000007) % 1000000007);
  12. cout << result << endl;
  13. }
  14. }
Success #stdin #stdout 0s 4900KB
stdin
6
4 5 2 3
10 20 2 4
10 20 10 20
7 8 7 7
2 2 1 1
1000000000000000000 1000000000000000000 1 1
stdout
14
192
0
7
3
2400