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==0: for i in range(1,21,max(A,B)): for j in range(1,21,max(A,B)): ans += 1/pow(i+j,i+j) 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)