import math, strutils let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() let P, Q = input(float) proc f(N: float): float = N * N - Q * N * log2(N) - P var ok = 1.0 var ng = 1e9 for _ in 1 .. 1000: var mid = (ok + ng) / 2.0 if f(mid) <= 0.0: ok = mid else: ng = mid echo ok