from math import gcd A,B=map(int,input().split()) if A==B==0: print(0.25) elif A==0 or B==0: C=max(abs(A),abs(B)) if C>=9: print(0.25) else: print(1/0) print([0.2912859971, 0.2539277432, 0.2503200596, 0.2500214336, \ 0.2500012143, 0.2500000596, 0.2500000026, 0.2500000001][C-1]) else: g=gcd(A,B) X=0 if g<=20: T=10 else: T=2 if (A//g)%2==(B//g)%2==1: for k in range(T): h=2*k*g+2 X+=(2*k+1)/(h**h) else: for k in range(T): h=k*g+2 X+=(k+1)/(h**h) print(X)