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