def calc(r, str = "")
  return str if str.length > 4
  a = r * 2
  b = a.to_i
  str += b.to_s
  c = a - b
  if c.zero?
    return str
  else
    calc(c, str)
  end
end


until (n = gets.to_f.rationalize) < 0
  integer_part = n.to_i
  decimal_part = n - integer_part
  
  result = "NA"
  str = integer_part.to_s(2)
  if str.length <= 8
    str = str.rjust(8, "0")
    tmp = calc(decimal_part)
    if tmp.length <= 4
      result = str + "." + tmp.ljust(4, "0")
    end
  end
  
  puts result
end
