A,B=map(int, input().split()) mod=10**9+7 ans=2*A*B+A+B ans%=mod if (A-B)%2==0: print((ans+1)%mod) else: print(ans)