function main() t = int(input()) ns = [inputs() for _ = 1:t] for (n_, s_) = ns n = int(n_) seisu, syosu = int(split(s_, ".")) if syosu == 0 println(n) continue end bottom, up = floor(Int, 1000 / (syosu + 1)), floor(Int, 1000 / syosu) # println(bottom, " to ", up) println(n ÷ up * (up - bottom) + max(0, n - n ÷ up * up - bottom)) end end # --------input func---------- input() = readline() inputs() = split(readline()) int(s::AbstractChar) = parse(Int, s) int(s::AbstractString) = parse(Int, s) int(v::AbstractArray) = map(x -> parse(Int, x), v) debug(x...) = println(stderr, x...) function _main() isequal(abspath(PROGRAM_FILE), @__FILE__) && return main() mystdin = joinpath(abspath(@__DIR__), "myinput.txt") redirect_stdio(stdin=mystdin) do main() end end _main()