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