import numpy as np



def resolve():

  n, l = list(map(int, input().split()))

  arr = []

  for i in range(n):

    arr.append(i + l)



  yotei = sum(arr)

  ans = abs(yotei - arr[0])

  sa = abs(yotei - (yotei - arr[0]))



  for i in range(n):

    if (sa > abs(yotei - (yotei - arr[i]))):

      sa = abs(yotei - (yotei - arr[i]))

      ans = yotei - arr[i]



  print(ans)



  return



if __name__ == "__main__":

  resolve()

INF = 1001001001



def resolve():

  n, l = list(map(int, input().split()))

  base = 0

  for i in range(1, n+1):

    base += l + i - 1



  ans = 0

  sa = INF



  for i in range(1, n+1):

    tmp = base - (l + i - 1)

    if abs(base - tmp) <= sa:

      ans = tmp

      sa = abs(base - tmp)

  print(ans)

  return



if __name__ == "__main__":

  resolve()

import numpy as np


def resolve():
    n, l = list(map(int, input().split()))
    arr = []
    for i in range(n):
        arr.append(i + l)
    yotei = sum(arr)
    ans = abs(yotei - arr[0])
    sa = abs(yotei - (yotei - arr[0]))
    for i in range(n):
        if sa > abs(yotei - (yotei - arr[i])):
            sa = abs(yotei - (yotei - arr[i]))
            ans = yotei - arr[i]
    print(ans)
    return


if __name__ == "__main__":
    resolve()

INF = 1001001001


def resolve():
    n, l = list(map(int, input().split()))
    base = 0
    for i in range(1, n + 1):
        base += l + i - 1
    ans = 0
    sa = INF
    for i in range(1, n + 1):
        tmp = base - (l + i - 1)
        if abs(base - tmp) <= sa:
            ans = tmp
            sa = abs(base - tmp)
    print(ans)
    return


if __name__ == "__main__":
    resolve()

-import numpy as np +INF = 1001001001 -    arr = [] -    for i in range(n): -        arr.append(i + l) -    yotei = sum(arr) -    ans = abs(yotei - arr[0]) -    sa = abs(yotei - (yotei - arr[0])) -    for i in range(n): -        if sa > abs(yotei - (yotei - arr[i])): -            sa = abs(yotei - (yotei - arr[i])) -            ans = yotei - arr[i] +    base = 0 +    for i in range(1, n + 1): +        base += l + i - 1 +    ans = 0 +    sa = INF +    for i in range(1, n + 1): +        tmp = base - (l + i - 1) +        if abs(base - tmp) <= sa: +            ans = tmp +            sa = abs(base - tmp)