Submission #19747

#TimeUsernameProblemLanguageResultExecution timeMemory
19747chan492811창문 (kriii4_C)C++98
0 / 100
0 ms1084 KiB
#include <cstdio> #include <algorithm> #define mod 1000000007 #define ll long long using namespace std; ll h,w,cnt,a,b,now; ll table[100]; void make_table(ll a){ int i; table[0]=a%mod; for(i=1;i<32;i++) table[i]=(table[i-1]*table[i-1])%mod; } ll pow(ll a,ll s){ ll i,now=1,res=1; make_table(a); for(i=0;s;i++){ if(s&now) res*=table[i],res%=mod,s-=now; now*=2; } return res; } int main(){ scanf("%lld %lld",&h,&w); h%=mod; w%=mod; cnt=(h*(h+1)/2)%mod; cnt*=(w*(w+1)/2); cnt%=mod; h*=w; h%=mod; h*=h; h%=mod; a=h; a*=9; a%=mod; now=__gcd(a,cnt); a/=now; cnt/=now; b=pow(cnt,mod-2); printf("%lld",(a*b)%mod*cnt); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...