Problem: In Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that can be considered as the shortest distance when traveling along the road from Sunuke-kun's house to Sumek-kun's house.

Constraints

* 0 <d ≤ 10
* d is given up to exactly three decimal places

Input


d


Output

Print the answer on one line. If the absolute error or relative error is 10-9 or less, the answer is judged to be correct.

Examples

Input

1.000


Output

2.000000000000


Input

2.345


Output

3.316330803765

Solution (in CPP):

Solution:
/*
 * 2629.cc: Manhattan
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long double ld;

/* global variables */

/* subroutines */

ld maxly(ld d, ld dx) {
  ld maxll = 0.0, d2 = d * d;
  for (ld y = 0.0; y <= d; y += 1.0) {
    ld x = sqrtl(d2 - y * y);
    ld l = x + y;
    if (y > 0.0 && x <= dx) {
      ld l0 = dx * 2 - x + y;
      ld l1 = 2.0 - dx * 2 + x + y;
      l = (l0 < l1) ? l0 : l1;
    }
    if (maxll < l) maxll = l;
  }
  return maxll;
}

ld maxlx(ld d, ld dx) {
  ld maxll = 0.0, d2 = d * d;
  for (ld x = 0.0; x + dx <= d; x += 1.0) {
    ld y = sqrtl(d2 - (x + dx) * (x + dx));
    ld l = x + dx + y;
    if (maxll < l) maxll = l;
  }
  return maxll;
}

ld search_max(ld d, ld dxl, ld dxr, ld (&f)(ld, ld)) {
  for (int i = 0; i < 200; i++) {
    ld dx0 = (dxl * 2 + dxr) / 3;
    ld dx1 = (dxl + dxr * 2) / 3;
    ld maxl0 = f(d, dx0);
    ld maxl1 = f(d, dx1);
    if (maxl0 > maxl1) dxr = dx1;
    else dxl = dx0;
  }
  return f(d, dxl);
}

/* main */

int main() {
  ld d;
  cin >> d;

  ld ly0 = search_max(d, 0.0, 0.5, maxly);
  ld ly1 = search_max(d, 0.5, 1.0, maxly);
  ld ly = (ly0 > ly1) ? ly0 : ly1;
  
  ld lx0 = search_max(d, 0.0, 0.5, maxlx);
  ld lx1 = search_max(d, 0.5, 1.0, maxlx);
  ld lx = (lx0 > lx1) ? lx0 : lx1;
  
  ld maxl = (ly > lx) ? ly : lx;
  printf("%.12Lf\n", maxl);
  return 0;
}