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
num = ["1000","0100","0010","0001","1100","1010","1001","0110","0101","0011","1110","1101","1011","0111","1111"]

hash=Hash.new
list.each_index do |i|
  hash[list[i]]=num[i]
end
hash[0]="0000"
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

  b=0if b==0
  unless hash[b]
    puts "NA"
    next
  end
  puts a+"."+hash[b]
end