#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  double n, x, traj, y;
  cin >> n >> x;
  traj = x + (n - x) + x + x;
  x = x / 2;
  traj += 3 * x;
  cout << traj << "\n";
  return 0;
}
