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 if a // g % 2 == 1 and b // g % 2 == 1: for i in range(1000): xy = 2 + 2 * (i + 1) * g if xy > 1000: break ans += (i + 1) / xy ** xy print(ans) exit(0) for i in range(1000): xy = 2 + i * g if xy > 1000: break ans += (i + 1) / xy ** xy print(ans)