program sum_of_large_numbers
  implicit none
  integer(8) :: n, k
  read(*,*) n, k
  write(*,'(i0)') mod(((n+1)*(n+k+1)*(n-k+2)*3+(n-k+2)*6-(n+1)*(n+2)*(2*n+3)+(k-1)*k*(2*k-1))/6,1000000007)
end program sum_of_large_numbers