from math import gcd A,B=map(int,input().split()) if A==B==0: print(0.25) 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)