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)) X=0 if C<=20: T=10 else: T=2 for k in range(T): h=(k*C+2) X+=1/(h**h) print(X) 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: X=1/0 for k in range(T): h=k*g+2 X+=(k+1)/(h**h) print(X)