#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, L;
    cin >> N >> L;

    if(L <= 0 && L + N - 1 > 0){
        cout << N * (L + L + N - 1) / 2 << endl;
    }else if(L + N - 1 <= 0){
        cout << (N - 1) * (L + L + N - 2) / 2 << endl;
    }else{
        cout << (N - 1) * (L + 1 + L + N - 1) / 2 << endl;
    }

    return 0;
}
#include <bits/stdc++.h>
#define io() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); srand(time(NULL));
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

signed main(){
    io();
    int n, k; cin >> n >> k;
    vector<int> v(n);
    int og = 0;
    for(int i = 0; i < n; ++i){
        v[i] = k + i;
        og += v[i];
    }   
    int index = 0;
    int maxi = INT_MAX;
    for(int i = 0; i < n; ++i){
        int dif = og - v[i];
        int dist = abs(og - dif);
        if(maxi > dist){
            maxi = dist;
            index = i;
        }
    }
    cout << og - v[index] << '\n';
    return 0;  
}