#include using namespace std; using LL = long long; using ULL = unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) LL GCD(LL a, LL b) { return b ? GCD(b, a % b) : a; } double F(LL x) { return pow(1. / double(x), double(x)); } int main() { cout << fixed << setprecision(10); LL A, B; cin >> A >> B; A = abs(A); B = abs(B); LL G = GCD(A, B); A /= G; B /= G; double ans = 0.; if (A % 2 == 1 && B % 2 == 1) { rep(x, 20) rep(y, 20) { if (x % G != 0 || y % G != 0) continue; if ((x + y) % 2 == 1) continue; ans += F(x + y + 2); } } else { rep(x, 20) rep(y, 20) { if (x % G != 0 || y % G != 0) continue; ans += F(x + y + 2); } } cout << ans << endl; return 0; }