#!/usr/bin/ruby -Ku

require 'pp'

pow = Hash.new

pow[-4] = 0.0625
for i in -3..7
  pow[i] = pow[i-1]*2
end

loop do
  n = gets.to_f
  break if n < 0

  bnum = String.new
  for i in -7..4
    bnum += n.div(pow[-i]).to_s
    n -= pow[-i] if n >= pow[-i]
    bnum += "." if i == 0
  end
  bnum = "NA" if n != 0
  
  puts bnum
end