#include <bits/stdc++.h>
using namespace std;
long long mul(long long a, long long b, long long p) {
long long k = (long long)((long double)a * b / p + 0.5);
return a * b - k * p;
}
int main() {
long long m = 1e11 + 7;
long long a = 1e11 - 1;
long long b = mul(a, a, m);
cout << b << endl; //correct
long double c = a;
long double d = fmod(c * c, m);
cout << d << endl; //wrong
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpsb25nIGxvbmcgbXVsKGxvbmcgbG9uZyBhLCBsb25nIGxvbmcgYiwgbG9uZyBsb25nIHApIHsKCWxvbmcgbG9uZyBrID0gKGxvbmcgbG9uZykoKGxvbmcgZG91YmxlKWEgKiBiIC8gcCArIDAuNSk7CglyZXR1cm4gYSAqIGIgLSBrICogcDsKfQoKCmludCBtYWluKCkgewoJbG9uZyBsb25nIG0gPSAxZTExICsgNzsKCQoJbG9uZyBsb25nIGEgPSAxZTExIC0gMTsKCWxvbmcgbG9uZyBiID0gbXVsKGEsIGEsIG0pOwoJY291dCA8PCBiIDw8IGVuZGw7CS8vY29ycmVjdAoJCglsb25nIGRvdWJsZSBjID0gYTsKCWxvbmcgZG91YmxlIGQgPSBmbW9kKGMgKiBjLCBtKTsKCWNvdXQgPDwgZCA8PCBlbmRsOwkvL3dyb25nCgkKCXJldHVybiAwOwp9