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