import math A, B = map(int, input().split()) def compute_sum(A, B): if A == 0 and B == 0: return 0.25 # Only the initial position (1,1) is reachable d = math.gcd(abs(A), abs(B)) if d == 0: return 0.25 # This case is redundant as d is at least 1 if A or B is non-zero res = 0.0 m = 0 while True: k = 2 + d * m term = (m + 1) / (k ** k) res += term if term < 1e-20: # Term is small enough to stop break m += 1 return res result = compute_sum(A, B) # Formatting the output to have enough decimal places and trimming trailing zeros formatted_result = "{0:.30f}".format(result).rstrip('0').rstrip('.') if '.' in "{0:.30f}".format(result) else "{0:.30f}".format(result) print(formatted_result)