from math import gcd A, B = map(int, input().split()) A = abs(A) B = abs(B) ans = 0 if A==B==0: ans = 1/4 elif A==B: for i in range(1,21): for j in range(1,21): if (i+j-2)%(2*A)==0: ans += 1/pow(i+j,i+j) elif A==0: for i in range(1,21,B): ans += 1/pow(i+1,i+1) elif B==0: for i in range(1,21,A): ans += 1/pow(i+1,i+1) else: g1 = gcd(A+B,A-B) g2 = gcd(A,B) for i in range(1,21, g2): for j in range(1,21, g2): if (i+j-2)%g1==0: ans += 1/pow(i+j,i+j) print(ans)