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