import math A,B=map(int,input().split()) if A<0:A=-A if B<0:B=-B G=math.gcd(A,B) if A==B:G*=2 if A==0 and B==0: print(0.25) exit(0) ans=0 for n in range(10000): x=n+1 y=2+n*G if y>1000000:break y=pow(y,y) ans+=x/y if x/y < 0.0000000001:break print(ans)