#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  double n, x, traj = 0, y, sx, sy, a, b;
  cin >> n >> x;
  sx = (n - x) * sqrt(3) / 2;
  sy = (n - x) / 2;
  a = sx;
  b = sy;
  long long nx = x;
  int flag = 0, st = 1;
  traj += x;
  a += x;
  traj += (n - x) + x;
  b -= (n - x) / 2;
  a -= (n - x) * sqrt(3) / 2;
  b += x / 2;
  a -= x * sqrt(3) / 2;
  while (a != sx && b != sx && x >= 1 || st == 1) {
    st = 0;
    if (flag == 1) {
      traj += x + x;
      b -= x / 2;
      a -= x * sqrt(3) / 2;
      b += x / 2;
      a -= x * sqrt(3) / 2;
      flag = 0;
      x = x / 2;
    } else {
      traj += x + x / 2;
      a += x;
      b += x / 2;
      a -= ((x / 2) * sqrt(3)) / 2;
      flag = 1;
      x = x / 2;
    }
  }
  cout << traj << "\n";
  return 0;
}
