Submission #19665

#TimeUsernameProblemLanguageResultExecution timeMemory
19665myungwoo창문 (kriii4_C)C++14
3 / 100
0 ms1084 KiB
#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;
	all = hdap*wdap%mod;
	printf("%lld", all*inv(hw)%mod);
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...