import math A, B = map(int, input().split()) if A == 0 and B == 0: print("{0:.12f}".format(0.25)) else: d = math.gcd(abs(A), abs(B)) sum_total = 0.0 n = 0 while True: denominator = d * n + 2 exponent = denominator term = (n + 1) / (denominator ** exponent) if term < 1e-20: # Stop when term becomes negligible break sum_total += term n += 1 # Ensure sufficient precision in output print("{0:.12f}".format(sum_total))