import math a, b = map(int, input().split()) g = math.gcd(abs(a), abs(b)) ans = 0 for x in range(10**2): for y in range(10**2): k = 2+g*(x+y) if k**k > 10**10: break ans += 10**6/k**k print(ans/10**6)