a, b = map(int, input().split()) p = 10 ** 9 + 7 kari = (a - b) % 2 a = a % p b = b % p ans = 0 if kari == 0: ans = (((a+1) * (b+1)) % p + (a * b) % p) % p else: ans = (((a+1) * b) % p + (a * (b+1)) % p) % p print("{}".format(ans))