#include //#include using namespace std; //using namespace atcoder; using ll = long long; using ull = unsigned long long; using P = pair; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define MOD 1000000007 int main(){ cout << fixed << setprecision(20); ll a,b; cin >> a >> b; ll c = __gcd(abs(a),abs(b)); double res = 0; if(c > 18){ cout << 0.25 << "\n"; return 0; } rep(i,20)rep(j,20){ if(2+c*i+c*j > 18)break; __int128_t k = 1; rep(g,2+c*i+c*j)k = k*(2+c*i+c*j); if(k >= (ll)1e16)break; res += 1.0/k; } cout << res << "\n"; return 0; }