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