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<stdio.h>
#define mod 1000000007
#define inv(a) exp(a,mod-2)
typedef long long lld;
lld a, b, sum;
lld exp(lld a, lld b){
if(b==0)return 1;
lld k=exp(a, b/2);
k=(k*k)%mod;
if(b%2)k=(k*a)%mod;
return k;
}
lld h, w, h2, w2, hw;
lld hdap, wdap, all;
int main(){
scanf("%lld%lld", &h, &w), h%=mod, w%=mod;
h2 = h*(h+1)%mod, w2 = w*(w+1)%mod;
h2 = h2*inv(2)%mod, w2 = w2*inv(2)%mod;
hw = h2*w2%mod;
hdap = h2*(h+2)%mod, wdap = w2*(w+2)%mod;
hdap = hdap*inv(3)%mod, wdap = wdap*inv(3)%mod;
all = hdap*wdap%mod;
printf("%lld", 9*all*inv(hw)%mod);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |