#yuki1681 mod=10**9+7 a,b=map(int,input().split()) if a%2==b%2: res=(a+1)*(b+1)+a*b else: res=(a+1)*b+(b+1)*a print(res%mod)