a, b = map(abs, map(int, input().split())) if a > b: a, b = b, a if b == 0: print(0.25) exit(0) from math import gcd g = gcd(a, b) ans = 0 for i in range(1000): xy = 2 + i * g ans += (i + 1) / xy ** xy print(ans)