while true
    arr = gets.chomp.split('.')
    break if arr[0][0] == '-'

    result = nil
        if arr[0].to_i >= 2 ** 8
        result = "NA"
    else
        arr << "0" if arr.length == 1
        r = Rational(arr[1], 10 ** (arr[1].length))
        b = ["0", "0", "0", "0"]
        c = Rational(1, 2)
        4.times{|i|
            if r >= c
                b[i] = "1"
                r -= c
            end
            c /= 2
        }
        if r == 0
            result = sprintf("%08b.", arr[0].to_i) + b.join
        else
            result = "NA"
        end
    end
    puts result
end
