program sample
  implicit none
  inetger N, L, M, k
  read(*,*) N, L
  M = 0
  do i =1, N
  M = M + L + i - 1
  end do
  k = M
  do i = 1, N
   if (  abs( M - L - i + 1) < k) then
    k = abs(M - L - i + 1)
   endif
  end do
  write(*,*) k
  stop
end program sample 