#include <bits/stdc++.h>
using namespace std;
const int N = (int)5e3 + 10;
const int M = (int)4e6 + 7;
const long long LINF = (long long)1e18;
const int INF = (int)1e9 + 7;
const double EPS = (double)1e-9;
const int mod = 1e9 + 7;
const int nx[4] = {1, -1, 0, 0};
const int ny[4] = {0, 0, 1, -1};
int main() {
  long long n, x;
  cin >> n >> x;
  cout << 2 * (n - x) * x;
  return 0;
}
