import math A,B = map(int,input().split()) A = abs(A); B = abs(B) if A == 0 and B == 0: ans = 0.25; print(ans); exit() MAX = 10 if A >= pow(10,4) or B >= pow(10,4): MAX = 1 ans = 0 if A == B: for y in range(MAX): for x in range(MAX): if y%2 == 0: kx = 1 + 2*A*x ky = 1 + A*y else: kx = 1 + 2*A*x + A ky = 1 + A*y temp = 1/pow(kx+ky,kx+ky) #print(x,y,kx,ky,temp) ans += temp print(ans);exit() k = math.gcd(A,B) #print(k) 片方ゼロならゼロではない数字がk ans = 0 for y in range(MAX): for x in range(MAX): kx = 1 + k*x ky = 1 + k*y temp = 1/pow(kx+ky,kx+ky) #print(kx,ky,temp) ans += temp print(ans)