### main

while true
  n = gets.strip
  break if n.to_f < 0

  rs, fs = n.split('.')

  r = rs.to_i
  if r >= (1 << 8)
    puts 'NA'
    next
  end

  f = fs.to_i
  f10 = 10 ** fs.length
  fb = ''
  4.times.each do
    f *= 2
    fb += (f / f10).to_s
    f %= f10
  end
  if f != 0
    puts 'NA'
    next
  end

  puts sprintf("%08b.%s", r, fb)
end