from math import gcd A, B = map(int, input().split()) A = abs(A) B = abs(B) ans = 0 if A==B: for i in range(1,21): for j in range(1,21): if (i+j)%(2*A)==0: ans += 1/pow(i+j,i+j) else: g = gcd(A,B) for i in range(1,21,g): for j in range(1,21,g): ans += 1/pow(i+j,i+j) print(ans)