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 <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long lld;
lld a,b,mod=1e9+7,ret,s,c;
lld foo(lld idx){
if(idx==1) return s;
lld k = foo(idx/2)%mod;
if(idx%2) return (((k*k)%mod)*s)%mod;
return (k*k)%mod;
}
int main(){
cin>>a>>b;
s = ((a*(a+1))/2) * ((b*(b+1))/2);
s%=mod;
c=foo(1e9+5)%mod;
for(lld dy=0; dy<a; dy++){
for(lld dx=0; dx<b; dx++){
for(lld ky=1; ky<=a; ky++){
for(lld kx=1; kx<=b; kx++){
if(dy+ky>a || dx+kx>b) break;
ret+=(ky)*(kx)*9;
ret%=mod;
}
}
}
}
cout<<(ret*c)%mod<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |