# -*- coding: utf-8 -*- """ Created on Sun Aug 1 14:11:40 2021 @author: sumitacchan """ A, B = map(int, input().split()) mod = 10**9 + 7 if A % 2 == B % 2: ans = ((2*A+1)*(2*B+1)+1)//2 else: ans = ((2*A+1)*(2*B+1)-1)//2 ans %= mod print(ans)