This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#define ull unsigned long long
const ull M = 1000000007;
ull pow(ull n, ull b) {
if (b == 0) {
return 1;
}
ull temp = pow(n, b / 2) % M;
if (b % 2 == 1) {
return temp*temp%M*(n%M) % M;
}
return temp*temp%M;
}
ull an(ull n) {
return ((((n%M * (n + 1) % M) % M * (2 * (n % M) % M + 1) % M) % M) + (n%M * (n + 1) % M) % M * 3 % M) % M;
}
ull total(ull h, ull w) {
return pow(h, M - 2) * pow(h + 1, M - 2) % M * pow(w, M - 2) % M * pow(w + 1, M - 2) % M;
}
int main(void) {
ull w, h;
scanf("%llu %llu", &w, &h);
w %= M;
h %= M;
ull a1 = an(w);
ull a2 = an(h);
ull tot = total(w, h) * pow(12 * 12, M - 2) % M;
printf("%llu", a2 * a1 % M * 9 % M * 2 % M * 2 % M * tot % M);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |