local function ask(num) io.write("? " .. num .. "\n") io.flush() local ret = io.read("*l") return ret == "safe" end local function ans(num) io.write("! " .. num .. "\n") io.flush() os.exit() end if not ask(1) then ans(0) end local left = 0 local right = 1000 local bls, brs = bit.lshift, bit.rshift while 1 < right - left do local mid = brs(left + right, 1) local mid2 = mid + 1 if ask(mid) then left = mid else if ask(mid2) then left = mid2 else right = mid end end end ans(left)