제출 #19793

#제출 시각아이디문제언어결과실행 시간메모리
19793sys7961창문 (kriii4_C)C++14
3 / 100
0 ms1084 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...