#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, i, j, res, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
  cin >> m >> n;
  a += n;
  b += m - n;
  c += n;
  d += n;
  e += (n / 2) * 3;
  res = a + b + c + d + e;
  cout << res << endl;
  return 0;
}
