b = [0.5,0.25,0.125,0.0625]
list = []
(1..4).each do |i|
  b.combination(i) do |arr|
    list << arr.inject{|sum,x| sum+x}
  end
end
#p list
loop do
  n=gets.chomp.to_f
  break if n <0
  a = n.floor
  b = n-a
  a=a.to_i.to_s(2)
  if a.size >8
    puts "NA"
    next
  end
  a = "%08d" % a.to_i
  if (b==0)
    puts a+"."+"0000"
  else
    if list.include?(b)
      print a+"."
      i=1
      while i<=4
        if (b-(2**-i))>=0
          b-=(2**-i)
          print 1
        else
          print 0
        end
        i+=1
      end
      print "\n"
    else
      puts "NA"
    end
  end
end