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