import sys input = sys.stdin.buffer.readline def main(): A,B = map(int,input().split()); MOD = pow(10,9) + 7 if B%2 == 0: #スタートB+1 x = ((A+1)//2)*2 y = (A//2)*2 + 1 ans = x*B + y*(B+1) else: #スタートがB x = ((A+1)//2)*2 y = (A//2)*2 + 1 ans = x*(B+1) + y*B print(ans%MOD) if __name__ == '__main__': main()