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