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