#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, ans;
  scanf("%d%d", &n, &x);
  if (n != x)
    ans = 3 * n - 1.5 * x;
  else
    ans = 3 * n;
  printf("%d", ans);
  return 0;
}
