#include <bits/stdc++.h>   using namespace std;   int main() {     long long int m, r, t, i;     long double s = 1.4142135623730950488;     long long int b, f;     long double d, ans, last, sum = 0;     long double x, y, z;     cin >> m >> r;     x = 2 * r;     y = 2 * r + (s * r);     z = 2 * r + (2 * s * r);     t = (m % 2 == 0) ? (m / 2) : (m / 2 + 1);     for (i = 1; i <= t; i++) {       d = x;       b = (i - 1);       f = (m - i);       if (f > 1) {         d = d + y + z;         d = d + (f - 2) * z + ((f - 1) * (f - 2) * (x)) / 2;       }       if (f == 1) {         d = y + d;       }       if (b > 1) {         d = d + y + z;         d = d + (b - 2) * z + ((b - 1) * (b - 2) * (x)) / 2;       }       if (b == 1) {         d = y + d;       }       sum = sum + d;       if (i == t) {         last = d;       }     }     sum = (m % 2 == 0) ? (2 * sum) : (2 * (sum - last) + last);     ans = (sum) / (m * m);     cout << setprecision(16) << ans << endl;     return 0;   }   