A, B = map(int, input().split()) A = abs(A) B = abs(B) if A == 0 or B == 0: if A == 0 and B == 0: print(0.25) else: m = max(A, B) S = 1/4 for i in range(102, 2, -1): if (i - 1) % m == 0: S += ((i - 1) // m + 1) / pow(i, i) print(S) else: S = 0 L = [[0 for _ in range(101)] for __ in range(101)] F = [0 for _ in range(101)] for i in range(-40, 40): for j in range(-40, 40): for k in range(-40, 40): for l in range(-40, 40): if i % 2 == l % 2 and j % 2 == k % 2: p = 1 + i * A + j * B q = 1 + k * A + l * B if 0 < p < 100 and 0 < q < 100 and 1 < p + q < 100: L[p][q] = 1 for i in range(100, 0, -1): for j in range(100, 0, -1): if i + j <= 100: F[i+j] += L[i][j] for i in range(100, 1, -1): S += F[i] / pow(i, i) print(S)