You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.
You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.
You planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.
You want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.
Find the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.
We can prove that this value is uniquely determined.

-----Constraints-----
 - 2 \leq N \leq 200
 - -100 \leq L \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N L

-----Output-----
Find the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.

-----Sample Input-----
5 2

-----Sample Output-----
18

The flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.

Difficulty: EASY

Solutions:
(n, l) = map(int, input().split())
r = l + n - 1
m = r if r < 0 else l
s = (l + r) * n // 2
print(s if l * r <= 0 else s - m)


(N, L) = map(int, input().split())
aji = []
for i in range(N):
	aji.append(L + i)
if L < 0 and L + N - 1 > 0:
	print(sum(aji))
elif L + N - 1 <= 0:
	print(sum(aji) - (L + N - 1))
elif L >= 0:
	print(sum(aji) - L)


(n, i) = map(int, input().split())
a = [x + i for x in range(n)]
print(sum(a) - min(a, key=abs))


(N, L) = map(int, input().split())
x = []
for i in range(1, N + 1):
	x.append(L + i - 1)
print(sum(x) - min(x, key=abs))


(n, l) = map(int, input().split())
ls = [i + l - 1 for i in range(1, n + 1)]
ls.remove(min(ls, key=abs))
print(sum(ls))


(N, L) = map(int, input().split())
apple = sorted([L + i - 1 for i in range(1, N + 1)], key=lambda x: abs(x))
print(sum(apple[1:]))


(n, l) = map(int, input().split())
list_x = [l + x - 1 for x in range(1, n + 1)]
applepai = sum(list_x)
list_dif = []
list_sum = []
for i in range(len(list_x)):
	tmp = list_x.pop(i)
	list_dif.append(abs(applepai - sum(list_x)))
	list_sum.append(sum(list_x))
	list_x.insert(i, tmp)
indx = list_dif.index(min(list_dif))
ans = list_sum[indx]
print(ans)


(N, L) = map(int, input().split())
a = []
for i in range(1, N + 1):
	a.append(L + i - 1)
b = []
for i in a:
	b.append(abs(i))
for i in range(1, N + 1):
	if abs(L + i - 1) == min(b):
		print(sum(a) - L - i + 1)


(n, l) = map(int, input().split())
c = 0
m = 100000
for i in range(1, n + 1):
	c += l + i - 1
	m = min(m, abs(l + i - 1))
if l < 0 and l - n <= 0:
	print(c + m)
else:
	print(c - m)


(n, l) = map(int, input().split())
apples = [i + l for i in range(n)]
apples.sort(key=lambda x: abs(x))
print(sum(apples) - apples[0])


(n, l) = map(int, input().split())
(su, mi) = (0, 9999)
for i in range(1, n + 1):
	su += l + i - 1
	if abs(l + i - 1) < abs(mi):
		mi = l + i - 1
print(su - mi)


(n, l) = map(int, input().split())
lst = []
for i in range(n):
	lst.append(l + i)
if 0 in lst:
	print(sum(lst))
elif l < 0:
	print(sum(lst) - lst[n - 1])
else:
	print(sum(lst) - lst[0])


(n, l) = map(int, input().split())
apples = list(range(l, l + n))
print(sum(apples) - min(apples, key=abs))


details = input().split()
N = int(details[0])
L = int(details[1])
counter = 0
new_list = []
number = 0
checker = True
for i in range(N):
	counter += L
	new_list.append(L + i)
	if number == 0 and L + i >= 0 and (checker == True):
		number += L + i
		checker = False
	elif number == 0 and i == N - 1 and (checker == True):
		number += L + i
		checker = False
print(sum(new_list) - number)


(n, l) = map(int, input().split())
aji = [l + i for i in range(n)]
aji.sort(key=abs)
print(sum(aji[1:]))


(n, l) = map(int, input().split())
a = 0
if l >= 0:
	a = (l + 1 + n + l - 1) * (n - 1) / 2
	print(int(a))
elif l < 0 and -l < n:
	a = (l + n + l - 1) * n / 2
	print(int(a))
elif l < 0 and -l >= n:
	a = (l + n + l - 2) * (n - 1) / 2
	print(int(a))


(n, l) = map(int, input().split())
aji = []
apple = min(range(l, l + n), key=abs)
print(sum(range(l, l + n)) - apple)


(N, L) = map(int, input().split())
R = range(L, L + N)
print(sum(R) - min(R, key=abs))


(n, l) = map(int, input().split())
L = []
a = 0
if 0 <= l:
	a = l
else:
	a = n - 1 + l
for i in range(n):
	if l + i == 0:
		a = 0
	L.append(l + i)
L.remove(a)
print(sum(L))


(n, l) = map(int, input().split())
a = 0
b = float('inf')
for i in range(n):
	a += i + l
	if abs(b) > abs(i + l):
		b = i + l
print(a - b)


(n, l) = map(int, input().split())
each_taste = []
for x in range(1, n + 1):
	each_taste.append(l + x - 1)
if min(each_taste) >= 0:
	print(sum(each_taste[1:]))
elif max(each_taste) >= 0:
	print(sum(each_taste))
else:
	print(sum(each_taste[:-1]))


(n, l) = map(int, input().split())
lis = sorted([int(x) for x in range(l, l + n)], key=abs)
print(sum(lis[1:]))


(n, l) = list(map(int, input().split()))
a = sorted([l + i for i in range(n)], key=abs)
print(sum(a[1:]))


(N, L) = map(int, input().split())
taste = sorted([i for i in range(L, L + N)], key=abs)
print(sum(taste[1:]))


(n, l) = map(int, input().split())
apple = []
for i in range(1, n + 1):
	apple.append(l + i - 1)
eat = sorted(apple, key=lambda x: abs(x))
print(sum(apple) - eat[0])


(n, l) = list(map(int, input().split()))
a = [l + i for i in range(n)]
summ = sum(a)
print(summ - min(a, key=abs))


(n, l) = map(int, input().split())
s = [0] * n
for i in range(n):
	s[i] = i + l
s.sort(key=abs)
print(sum(s[1:]))


(n, l) = list(map(int, input().split()))
arr = []
arr2 = []
for k in range(1, n + 1):
	arr.append(abs(l + k - 1))
for k in range(1, n + 1):
	arr2.append(l + k - 1)
arr2.pop(arr.index(min(arr)))
print(sum(arr2))


(N, L) = map(int, input().split())
s = N * L
for i in range(N + 1):
	s += i
s -= N
K = []
for i in range(1, N + 1):
	K.append(L + i - 1)
if 0 <= K[0]:
	s -= K[0]
elif K[0] < 0 and K[N - 1] > 0:
	s = s
else:
	s -= K[N - 1]
print(s)


(n, l) = map(int, input().split())
tastes = [i for i in range(l, l + n)]
ans = sum(tastes) - min(tastes, key=abs)
print(ans)


(n, l) = map(int, input().split())
a = 0
for i in range(1, n + 1):
	a += l + i - 1
m = 10 ** 9
idx = 1
for i in range(1, n + 1):
	if abs(l + i - 1) < m:
		m = abs(l + i - 1)
		idx = i
print(a - (l + idx - 1))


(n, l) = map(int, input().split())
a = [i + l for i in range(n)]
a.remove(min(a, key=abs))
print(sum(a))


(N, L) = map(int, input().split())
val = L * N + 0.5 * N * (N + 1) - N
if L > 0:
	val -= L
elif L + N - 1 < 0:
	val -= L + N - 1
print(int(val))


(n, l) = map(int, input().split())
ans = l * n - n + (1 + n) * n // 2
if 0 < l:
	ans = ans - l
elif l < 1 - n:
	ans = ans - (l + n - 1)
print(ans)


(a, b) = map(int, input().split())
n = list(range(b, b + a))
o = []
for i in n:
	o.append(abs(i))
del n[o.index(min(o))]
print(sum(n))


(n, l) = map(int, input().split())
taste = [l + i for i in range(n)]
eat = min(taste, key=abs)
taste.remove(eat)
print(sum(taste))


(n, l) = map(int, input().split())
ringo = []
for i in range(l, l + n):
	ringo.append(i)
ringo.sort(key=int)
if 0 in ringo:
	print(sum(ringo))
else:
	if ringo[0] > 0:
		ringo.pop(0)
	else:
		ringo.pop(-1)
	print(sum(ringo))


(N, L) = map(int, input().split())
a = [x + L for x in range(N)]
print(sum(a) - min(a, key=lambda x: abs(x)))


import sys
(n, l) = map(int, input().split())
taste_list = [l + x - 1 for x in range(1, n + 1)]
taste_sum = sum(taste_list)
diff = sys.maxsize
for i in range(n):
	if diff > abs(taste_list[i]):
		diff = abs(taste_list[i])
		num = i
print(taste_sum - taste_list[num])


(N, L) = map(int, input().split())
ll = list(range(L, N + L))
a = list(map(abs, ll))
print(sum(ll) - ll[a.index(min(a))])


(N, L) = map(int, input().split())
a = []
for i in range(1, N + 1):
	a.append(L + i - 1)
A = list(map(abs, a))
print(sum(a) - a[A.index(min(A))])


lst = input()
lst = lst.split()
for i in range(len(lst)):
	lst[i] = int(lst[i])
N = lst[0]
L = lst[1]
q = L
l = 0
lste = [abs(L)]
tlst = []
for i in range(2, N + 1):
	t = L + i - 1
	q += t
	tlst.append(t)
	t = abs(t)
	lste.append(t)
slst = sorted(lste)
l = slst[0]
if tlst.count(-l) > 0:
	print(q + l)
else:
	print(q - l)


(N, L) = list(map(int, input().split()))
tastes = [L + i for i in range(N)]
print(sum(tastes) - min(tastes, key=abs))


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LSS():
	return input().split()

def resolve():
	(N, L) = LI()
	ans = (2 * L + N - 1) * N // 2
	if 0 <= L:
		ans -= L
	elif L + N <= 0:
		ans -= L + N - 1
	print(ans)

def __starting_point():
	resolve()
__starting_point()


(n, like) = map(int, input().split())
arr = [like + i for i in range(n)]
arr.sort(key=abs)
print(sum(arr[1:]))


(n, l) = map(int, input().split())
m = list(range(l, l + n))
if m[-1] < 0:
	print(sum(m[:n - 1]))
elif m[0] > 0:
	print(sum(m[1:]))
else:
	print(sum(m))


import sys
sys.setrecursionlimit(10 ** 9)

def int1(x):
	return int(x) - 1

def II():
	return int(input())

def MI():
	return list(map(int, input().split()))

def MI1():
	return list(map(int1, input().split()))

def LI():
	return list(map(int, input().split()))

def LI1():
	return list(map(int1, input().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def MS():
	return input().split()

def LS():
	return list(input())

def LLS(rows_number):
	return [LS() for _ in range(rows_number)]

def printlist(lst, k=' '):
	print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
	(N, L) = MI()
	tot = 0
	for i in range(1, N + 1):
		tot = tot + L + i - 1
	diff = INF
	ans = 0
	for i in range(1, N + 1):
		tmp = tot - L - i + 1
		if abs(tot - tmp) < diff:
			diff = abs(tot - tmp)
			ans = tmp
	print(ans)

def __starting_point():
	solve()
__starting_point()


(n, l) = map(int, input().split())
s = int(n * (2 * l + n - 1) / 2)
if l <= 0 and l + n - 1 >= 0:
	print(s)
elif l <= 0:
	print(s - l - n + 1)
else:
	print(s - l)


(n, l) = map(int, input().split())
a = []
for i in range(l, n + l):
	a.append(i)
if a[0] > 0:
	b = a.pop(0)
elif a[n - 1] < 0:
	b = a.pop(n - 1)
else:
	for j in range(n):
		if a[j] == 0:
			b = a.pop(j)
			break
print(sum(a))


(n, l) = map(int, input().split())
a = [i + l - 1 for i in range(1, n + 1)]
t = [abs(i) for i in a]
a.pop(t.index(min(t)))
print(sum(a))


(n, l) = map(int, input().split())
a = 0
b = 10000
for i in range(n):
	a += l + i
	if abs(l + i) < abs(b):
		b = l + i
print(a - b)


(n, l) = map(int, input().split())
a = range(l, l + n)
print(sum(a) - min(a, key=abs))


def ApplePie():
	(N, L) = input().split()
	N = int(N)
	L = int(L)
	flavors = []
	for i in range(N):
		flavors.append(L + i)
	if 0 in flavors:
		flavors.remove(0)
		result = 0
		for i in flavors:
			result = result + i
		print(result)
		return
	elif L >= 0:
		del flavors[0]
		result = 0
		for i in flavors:
			result = result + i
		print(result)
		return
	else:
		del flavors[-1]
		result = 0
		for i in flavors:
			result = result + i
		print(result)
		return
ApplePie()


(n, l) = [int(k) for k in input().split(' ')]
res = sum(range(l, n + l))
if l < 0:
	res -= min(0, l + n - 1)
else:
	res -= l
print(res)


(n, l) = map(int, input().split())
t = n * l - n + (1 + n) * n // 2
a = l + n - 1
if 0 < l:
	print(t - l)
elif a < 0:
	print(t - a)
else:
	print(t)


(N, L) = map(int, input().split())
list_ = list(range(L, L + N))
print(sum(list_) - min(list(map(abs, list_))) * (1, -1)[max(list_) < 0])


(n, l) = (int(i) for i in input().split())
d = (l - 1) * n + (n + 1) * n // 2
if l < 1:
	print(d + 1 - l - min(n, 1 - l))
else:
	print(d - l)


(n, l) = map(int, input().split())
apple = [l + i for i in range(n)]
s = 0
while True:
	if s in apple:
		apple.remove(s)
		break
	elif abs(s) in apple:
		apple.remove(abs(s))
		break
	s -= 1
print(sum(apple))


r = input().split()
N = int(r[0])
L = int(r[1])
ans = 0
ans_li = []
for i in range(N):
	ans += L + (i + 1) - 1
	ans_li.append(L + (i + 1) - 1)
if 0 in ans_li:
	print(ans)
elif max(ans_li) > 0:
	print(ans - min(ans_li))
else:
	print(ans - max(ans_li))


(N, L) = map(int, input().split())
if L > 0:
	print(N * (2 * L + N - 1) // 2 - L)
else:
	print(N * (2 * L + N - 1) // 2 - min(L + N - 1, 0))


(N, L) = map(int, input().split())
l = list(map(lambda x: L + x - 1, range(1, N + 1)))
print(sum(l) - min(l, key=abs))


import numpy as np
(N, L) = list(map(int, input().split()))
taste = np.arange(1, N + 1) + L - 1
min_ind = np.argmin(np.abs(taste))
mask_1 = np.ones(N, dtype=bool)
mask_1[min_ind] = False
ans = np.sum(taste[mask_1])
print(ans)


(N, L) = map(int, input().split())
aji1 = []
ajimin = 1000
for i in range(1, N + 1):
	aji1.append(L + i - 1)
	if abs(ajimin) >= abs(aji1[i - 1]):
		ajimin = aji1[i - 1]
print(sum(aji1) - ajimin)


(n, k) = map(int, input().split())
sum = k
tmp = k
for i in range(1, n):
	sum += k + i
	if abs(tmp) > abs(k + i):
		tmp = k + i
print(sum - tmp)


(n, l) = map(int, input().split())
lt = [l + i for i in range(n)]
if min(lt) > 0:
	print(sum(lt[1:]))
elif max(lt) < 0:
	print(sum(lt[:n - 1]))
else:
	print(sum(lt))


(n, l) = map(int, input().split())
s = n * (2 * l + n - 1) // 2
if l > 0:
	s -= l
elif l == 0:
	pass
elif l + n <= 0:
	s -= l + n - 1
print(s)


(n, l) = map(int, input().split())
b = [l + i for i in range(n)]
a = list(map(abs, b))
m = a.index(min(a))
b.pop(m)
print(sum(b))


(n, l) = list(map(int, input().split()))
m = sorted(list(range(l, l + n)), key=abs)
print(sum(m[1:]))


(N, L) = map(int, input().split())
ans = 0
for i in range(1, N + 1):
	if L - 1 >= 0 and i == 1:
		continue
	if L - 1 < 0 and L + N - 1 >= 0 and (i == 1 - L):
		continue
	if L - 1 < 0 and L + N - 1 < 0 and (i == N):
		continue
	ans += L + i - 1
print(ans)


(N, L) = map(int, input().split())
r = [L + i - 1 for i in range(1, N + 1)]
e = min(r, key=abs)
print(sum(r) - e)


def answer(n: int, l: int) -> int:
	apples_taste = list(range(l, l + n))
	applepie_taste = sum(apples_taste) - min(apples_taste, key=abs)
	return applepie_taste

def main():
	(n, l) = list(map(int, input().split()))
	print(answer(n, l))

def __starting_point():
	main()
__starting_point()


(N, L) = list(map(int, input().split()))
azi2 = []
azi = [L + i for i in range(N)]
for i in azi:
	azi2.append(abs(i))
if 0 in azi:
	print(sum(azi))
else:
	mi = azi2.index(min(azi2))
	del azi[mi]
	print(sum(azi))


(N, L) = map(int, input().split())
Max = L + N - 1
a = int((L + Max) * N / 2)
if Max < 0:
	a = a - Max
if Max > 0:
	if L > 0:
		a = a - L
print(a)


(n, l) = map(int, input().split())
isMina = False
isPlu = False
ans = []
for i in range(1, n + 1):
	ans.append(l + i - 1)
	if l + i - 1 < 0:
		isMina = True
	elif i + i - 1 > 0:
		isPlu = True
print(sum(ans) - min(ans) if not isMina else sum(ans) - max(ans) if not isPlu else sum(ans))


(N, L) = list(map(int, input().split()))
nin = 10 ** 6
for i in range(N):
	if abs(L + i) < nin:
		nin = abs(L + i)
		nn = L + i
ans = N * (L - 1) + N * (N + 1) * 0.5 - nn
print(int(ans))


(n, l) = map(int, input().split())
L = [l + i - 1 for i in range(1, n + 1)]
Labs = list(map(abs, L))
print(sum(L) - L[Labs.index(min(Labs))])


(N, L) = list(map(int, input().split()))
A = 0
a = 1000
for i in range(1, N + 1):
	x = L + i - 1
	A += x
	if abs(x) < a:
		a = abs(x)
if A >= 0:
	print(A - a)
else:
	print(A + a)


(N, L) = map(int, input().split())
t = sorted(list(range(L, L + N)), key=abs)
print(sum(t[1:]))


(n, l) = map(int, input().split())
t = list(range(l, l + n))
s = [abs(_) for _ in t]
print(sum(t) - t[s.index(min(s))])


(N, L) = map(int, input().split())
tmp = [L + i - 1 for i in range(1, N + 1)]
ans = sorted(tmp, key=abs)
print(sum(ans) - ans[0])


(N, L) = map(int, input().split())
S = (2 * L + N - 1) * N // 2
if L <= 0 <= L + N - 1:
	ans = S
elif L < 0:
	ans = S - (L + N - 1)
else:
	ans = S - L
print(ans)


(n, a) = map(int, input().split())
l = a
r = a + n - 1
if r <= 0:
	e = r
elif l >= 0:
	e = l
else:
	e = 0
print(int((r + l) * (r - l + 1) / 2 - e))


(N, L) = map(int, input().split())
v = [L + i for i in range(N)]
ans = sum(v) - min(v, key=abs)
print(ans)


(N, L) = map(int, input().split())
s = N * (2 * L + N - 1) // 2
l = [abs(L + i) for i in range(N)]
print(s - (L + l.index(min(l))))


(a, b) = map(int, input().split())
c = [i + b for i in range(a)]
d = [abs(j + b) for j in range(a)]
print(sum(c) - c[d.index(min(d))])


(N, L) = list(map(int, input().split()))
A = [i for i in range(L, L + N)]
if A[0] < 0:
	if A[-1] < 0:
		print(sum(A) - max(A))
	else:
		print(sum(A))
else:
	print(sum(A) - min(A))


(N, L) = map(int, input().split())
total = N * (L - 1) + N * (N + 1) / 2
lowest = 10 ** 10
for i in range(1, N + 1):
	y = L + i - 1
	lowest = min(lowest, abs(y))
print(int(total) - lowest) if total >= 0 else print(int(total) + lowest)


(n, l) = list(map(int, input().split()))
S = n * l + n * (n + 1) // 2 - n
pd = S + 1
for x in range(1, n + 1):
	d = -l - x + 1
	if pd > abs(d):
		ans = S + d
	pd = d
print(ans)


(N, L) = map(int, input().split())
aji_list = [L + i - 1 for i in range(1, N + 1)]
basic = abs(sum(aji_list))
min_diff = 9999999
for i in aji_list:
	diff = abs(basic - abs(basic - abs(i)))
	min_diff = min(min_diff, diff)
for i in aji_list:
	if abs(basic - abs(basic - abs(i))) == min_diff:
		if basic == sum(aji_list):
			print(basic - abs(i))
		else:
			print(-1 * (basic - abs(i)))
		break


(n, l) = list(map(int, input().split()))
if l >= 0:
	print((n - 1) * l + n * (n + 1) // 2 - (n - 1) - 1)
elif n >= -l + 1:
	print(n * l + n * (n + 1) // 2 - n)
else:
	print((n - 1) * l + n * (n + 1) // 2 - (n - 1) - n)


(N, L) = map(int, input().split())
apples = list(range(L, L + N))
s = sum(apples)
print(s - sorted(apples, key=lambda x: abs(x))[0])


(N, L) = map(int, input().split())
Apple = list(range(L, L + N))
Apple.sort(key=lambda x: abs(x))
print(sum(Apple[1:]))


(N, L) = [int(i) for i in input().split()]
t = L * (N - 1) if L >= 0 else L * N if N + L > 0 else L * N - (L + N - 1)
print(N * (N - 1) // 2 + t)


(n, l) = map(int, input().split())
d = list(range(l, n + l))
d_eaten = min(d, key=lambda x: abs(x))
print(sum(d) - d_eaten)


(N, L) = list(map(int, input().split()))
stk = []
ans = []
for i in range(N):
	tmp = L + i
	stk.append(tmp)
for i in range(N):
	tmp1 = sum(stk)
	tmp = stk[i]
	stk[i] = 0
	tmp2 = sum(stk)
	stk[i] = tmp
	ans.append(abs(tmp1 - tmp2))
tmp = min(ans)
if tmp in stk:
	stk.remove(tmp)
	print(sum(stk))
else:
	stk.remove(-tmp)
	print(sum(stk))


(n, L) = map(int, input().split())
a = list(range(L, n + L))
tmp = 500
for i in a:
	if abs(tmp) > abs(i):
		tmp = i
print(sum(a) - tmp)


(n, l) = map(int, input().split())
if 0 <= l:
	t = 1
else:
	t = min(n, -l + 1)
print(int(1 / 2 * n * (2 * l + n - 1) - (t + l - 1)))


(K, L) = map(int, input().split())
apple = [i for i in range(L, L + K)]
apple.sort(key=lambda x: abs(x))
print(sum(apple[1:]))


(N, L) = map(int, input().split())
chosen = 1000
for i in range(1, N + 1):
	taste_eaten = L + i - 1
	if abs(taste_eaten) < abs(chosen):
		chosen = taste_eaten
print(int(N * L + N * (N + 1) / 2 - N - chosen))


(N, L) = map(int, input().split())
ans = (L - 1) * N + (N + 1) * N // 2
if L < 0 and L + N - 1 < 0:
	ans -= L + N - 1
elif L > 0:
	ans -= L
print(ans)


(N, L) = map(int, input().split())
A = [L + i for i in range(N)]
A.remove(min(max(A), *[abs(a) for a in A]))
print(sum(A))


(N, L) = map(int, input().split())
azi = [L + i - 1 for i in range(1, N + 1)]
absmin = L ** 2
for i in range(N):
	absmin = min(absmin, abs(azi[i]))
if absmin in azi:
	print(sum(azi) - absmin)
else:
	print(sum(azi) + absmin)


(n, l) = map(int, input().split())
ans = [l + i - 1 for i in range(1, n + 1)]
mn = min(ans, key=lambda x: abs(x))
print(sum(ans) - mn)


(N, L) = map(int, input().split())
apples = [i + L - 1 for i in range(1, N + 1)]
ans = float('inf')
res = float('inf')
for apple in apples:
	if ans > abs(apple):
		ans = min(ans, abs(apple))
		res = apple
print(sum(apples) - res)


(n, l) = map(int, input().split())
aji = [l + i for i in range(n)]
print(sum(aji) - min(aji, key=abs))


(n, l) = map(int, input().split())
s = 0
m = 10 ** 3
for i in range(n):
	s += l + i
	if abs(m) > abs(l + i):
		m = l + i
print(s - m)


(n, l) = map(int, input().split())
li = [l + i for i in range(n)]
print(sum(li) - sorted(li, key=lambda x: abs(x))[0])


(n, a) = map(int, input().split())
apples = [a + i for i in range(n)]
eat = min(apples, key=lambda x: abs(x))
res = sum(apples) - eat
print(res)


(n, l) = map(int, input().split())
List1 = []
List2 = []
for i in range(n):
	L = l + i
	L_abs = abs(L)
	List1.append(L)
	List2.append(L_abs)
if min(List2) in List1:
	List1.remove(min(List2))
elif -min(List2) in List1:
	List1.remove(-min(List2))
print(sum(List1))


(N, L) = map(int, input().split())
s = N * (2 * L + N - 1) // 2
if L + N - 1 < 0:
	eat = L + N - 1
elif L > 0:
	eat = L
else:
	eat = 0
print(s - eat)


(n, l) = map(int, input().split())
q = []
p = []
ans = 0
for i in range(1, n + 1):
	m = l + i - 1
	q.append(m)
	ans += m
for i in range(n):
	p.append(abs(q[i]))
print(ans - q[p.index(min(p))])


(n, l) = (int(i) for i in input().split())
r = l
s = 0
for i in range(n):
	if l + i <= 0:
		r = l + i
	s = s + l + i
print(s - r)


(N, L) = map(int, input().split())
minabs = 10 ** 9
apples = []
for i in range(N):
	t = L + i
	apples.append(t)
	if abs(t) < abs(minabs):
		minabs = t
full = sum(apples)
print(full - minabs)


(n, l) = list(map(int, input().split()))
apples = []
min_val = l
for i in range(1, n + 1):
	apples.append(l + i - 1)
	if abs(l + i - 1) < abs(min_val):
		min_val = l + i - 1
apples.remove(min_val)
print(sum(apples))


(N, L) = map(int, input().split())
apple = [L + i - 1 for i in range(1, N + 1)]
apple.remove(min(apple, key=abs))
print(sum(apple))


(N, L) = list(map(int, input().split()))
eat = 0
if L + N - 1 < 0:
	eat = L + N - 1
if L > 0:
	eat = L
print(N * (L + N - 1 + L) // 2 - eat)


(N, L) = map(int, input().split())
apple = [L + i - 1 for i in range(1, N + 1)]
apple.sort(key=abs)
print(sum(apple[1:]))


import sys
(N, L) = list(map(int, input().split()))
tastes = [L + x for x in range(N)]
if 0 in tastes:
	print(sum(tastes))
	return
if L < 0:
	absmin = max(tastes)
	print(sum(tastes) - absmin)
elif L > 0:
	absmin = min(tastes)
	print(sum(tastes) - absmin)


(n, l) = map(int, input().split())
l_list = [l + i - 1 for i in range(1, n + 1)]
ab_list = [abs(i) for i in l_list]
num = ab_list.index(min(ab_list))
print(sum(l_list) - l_list[num])


(n, l) = map(int, input().split())
a = []
for i in range(1, n + 1):
	a.append(i + l - 1)
a.sort(key=abs)
print(sum(a[1:]))


(n, l) = list(map(int, input().split()))
aji = []
m = 100000
flg = 0
for i in range(n):
	aji.append(l + i)
	if abs(aji[i]) <= m:
		m = abs(aji[i])
		if aji[i] <= 0:
			flg = 1
		else:
			flg = 0
print(sum(aji) - m if flg == 0 else sum(aji) + m)


import heapq
(n, l) = map(int, input().split())
a = [l + i for i in range(n)]
print(sum(a) - min(a, key=lambda x: abs(x)))


(n, l) = map(int, input().split())
apples = [i + l - 1 for i in range(1, n + 1)]
print(sum(apples) - min(((abs(x), x) for x in apples))[1])