Submission #19974

#TimeUsernameProblemLanguageResultExecution timeMemory
19974algoshipda창문 (kriii4_C)C++14
3 / 100
0 ms1720 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lld; const lld MOD = 1e9 + 7; lld fpow(lld n, lld k) { if(k == 0) return 1; if(k % 2){ return 1ll * n * fpow(n, k - 1) % MOD; } lld h = fpow(n, k / 2); return 1ll * h * h % MOD; } inline lld inv(lld n) { return 1ll * fpow(n, MOD - 2) % MOD; } inline void mult(lld& a, lld b) { a = 1ll * a * b % MOD; } inline lld mult2(lld a, lld b) { return 1ll * a * b % MOD; } inline void sub(lld& a, lld b) { a = ((a - b) % MOD + MOD) % MOD; } inline lld rational(lld a, lld b) { return 1ll * a * inv(b) % MOD; } inline void add(lld &a, lld b) { a = ((a + b) % MOD + MOD) % MOD; } inline lld add2(lld a, lld b) { return ((a + b) % MOD + MOD) % MOD; } int main() { lld h, w; cin >> h >> w; h %= MOD; w %= MOD; lld b = mult2(mult2(mult2(h,h+1), mult2(w,w+1)), inv(4)); lld hh = h; mult(hh, h+1); mult(hh, h+2); mult(hh, inv(6)); lld ww = w; mult(ww, w+1); mult(ww, w+2); mult(ww, inv(6)); lld a = mult2(hh,ww); mult(a, 9); cout << mult2(a, inv(b)) << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...