require 'mathn'
loop do
    x = gets.to_f
    break if x < 0
    if x >= 2 ** 8
        puts 'NA'
        next
    end
    t = 1
    until x == x.to_i
        x *= 10
        t *= 10
    end
    x = x.to_i / t
    k = 7
    s = ''
    until k < -4
        if x >= 2 ** k
            x -= 2 ** k
            s += ?1
        else
            s += ?0
        end
        s += ?. if k == 0
        k -= 1
    end
    if x > 0
        puts 'NA'
    else
        puts s
    end
end
