unittest
{
	assert( [ "5 2" ].solve == 18 );
	assert( [ "3 -1" ].solve == 0 );
	assert( [ "30 -50" ].solve == -1044 );
}



import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto l = 0L;
	input.front.formattedRead!"%s %s"( n, l );
	
	auto t = 0L;
	auto m = long.max;
	foreach( i; 0L .. n )
	{
		auto x = l + i.signed;
		t += x;
		if( x.abs < m.abs ) m = x;
	}
	return t - m;
}
