A, B = map(int, input().split()) A, B = abs(A), abs(B) ans = 0 T = 30 Closed = [[False]*T for i in range(T)] for a1 in range(T): for b1 in range(T): x = a1*A + b1*B + 1 if not 1 <= x < T: continue for a2 in range(T): for b2 in range(T): y = a2*A + b2*B + 1 if not 1 <= y < T: continue if (a1+b1+a2+b2) % 2: continue if not Closed[y][x]: Closed[y][x] = True ans += 1/((x+y)**(x+y)) print(ans)