Submission #19248

#TimeUsernameProblemLanguageResultExecution timeMemory
19248kaTkaHr창문 (kriii4_C)C++14
3 / 100
0 ms1084 KiB
#include <stdio.h> #include <algorithm> #include <map> using namespace std; typedef long long ll; const int MX = 105, MM = 1000000007; ll rv(ll A){ ll R = 1, B = MM-2; while(B){ if( B&1 ) R = R * A % MM; A = A * A % MM; B /= 2; } return R; } struct frac{ ll A, B; frac(ll a, ll b){ A = (a%MM+MM) % MM; B = (b%MM+MM) % MM; } frac(){A = 0, B = 1;} frac operator+ (const frac &l)const{ return frac((A * l.B + B * l.A) % MM, B * l.B % MM); } frac operator*(const frac &l)const{ return frac(A*l.A % MM, B*l.B % MM); } frac operator/(const frac &l)const{ return frac(A*l.B % MM, B*l.A % MM); } frac operator- (const frac &l)const{ return frac((A*l.B - B*l.A%MM + MM) % MM, B*l.B % MM); } ll v(){ return A * rv(B) % MM; } }; int main() { ll H, W; scanf("%lld%lld", &H, &W); frac w = frac(0, 1), h = frac(0, 1), t = frac(0, 1); w = frac(W, 2) * frac(W+1, 1) * frac(W+1, 1) - frac(W, 2) * frac(W+1, 3) * frac(2*W+1, 1); h = frac(H, 2) * frac(H+1, 1) * frac(H+1, 1) - frac(H, 2) * frac(H+1, 3) * frac(2*H+1, 1); t = frac(2, H) * frac(1, H+1) * frac(2, W) * frac(1, W+1); printf("%lld\n", (frac(9, 1)*w*h*t).v()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...