x,y = map(int,input().split()) a = max(x,y) b = min(x,y) l = 1000000007 if (a-b)%2==0: target1 = ((2*b+1)%l)*((a-b+1)%l)%l target2 = ((b%l)**2)%l*2 ans = (target1+target2)%l else: target1 = ((2*b+1)%l)*((a-b)%l)%l target2 = ((b%l)*((b+1)%l))%l*4%l ans = (target1+target2)%l print(ans)