a,b = map(int,input().split()) mod = 10**9+7 if a*b == 0: if a%2 or b%2: print((a+b)%mod) else: print((a+b+1)%mod) exit() if a > b: a,b = b,a if a%2 == b%2: l = (a-b)//2 r = (b-a)//2 ans = (r-l+1)*(2*a+1)%mod ans += (2*a)*((2*a+1)//2)%mod else: if a%2: l = (a-b+1)//2 r = (b-a-1)//2 ans = (r-l+1)*(2*a+1)%mod ans += (2*a+1)*((2*a+1)//2)%mod else: l = (a-b+1)//2 r = (b-a-1)//2 ans = (r-l+1)*(2*a+1)%mod ans += (2*a+2)*(a)%mod print(ans%mod)