/** * @FileName a.cpp * @Author kanpurin * @Created 2020.10.30 22:15:35 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { ll a,b;cin >> a >> b; if (a == 0 && b == 0) { cout << 0.25 << endl; return 0; } else if (a == 0 || b == 0) { a = a+b; a = abs(a); double ans = 0; for (int i = 0; i <= 1000000/a; i++) { ans += 1.0/pow(i*a+2,i*a+2); } printf("%.10f\n",ans); return 0; } a = abs(a); b = abs(b); ll g = __gcd(a,b); double ans = 0; for (int i = 0; i <= 1000000/g; i++) { ans += 1.0/pow(i*g+2,i*g+2)*(i+1); } printf("%.10f\n",ans); return 0; }