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