#include <bits/stdc++.h>
using namespace std;
int main(void) {
  double n, x, ans;
  cin >> n >> x;
  ans = x;
  ans += n - x;
  ans += ((n - x) - (x / 2)) * 2;
  ans += (x / 2) * 3;
  printf("%.0f\n", ans);
}
