/**
*    created: 03.07.2020 16:00:37
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    cout << 2 * b - a << endl;
    return 0;
}
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 202;
int a[N];

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, l;
    scanf("%d %d", &n, &l);
    int sum = 0;
    for (int i = 1; i <= n; i++) {
		sum += l + i - 1;
	}
	int res, mn = 1e9, tot = sum;
	for (int i = 1; i <= n; i++) {
		tot -= l + i - 1;
		if (abs(tot - sum) < mn) {
			mn = abs(tot - sum);
			res = tot;
		}
		tot += l + i - 1;
	}
	printf("%d", res);
    return 0;
}
