import scala.annotation.tailrec
import scala.io.StdIn._
object Main extends App {
  loop()
  @tailrec def loop(): Unit = {
    val str: String = readLine.trim
    if (str.headOption.contains('-')) return
    if (str.contains('.')) {
      val Array(integer, underPoint) = str.split('.')
      if (integer.length > 3 || integer.toInt >= 256 || (str.toDouble * 16) - (str.toDouble * 16).toInt != 0) {
        println("NA")
      } else {
        val int = integer.toInt.toBinaryString
        val under = ((str.toDouble * 16).toInt % 16).toBinaryString
        println("0" * (8 - int.length) + int + "." + ("0" * (4 - under.length)) + under)
      }
    }else {
      if (str.toInt >= 256) println("NA")
      else {
        val int = str.toInt.toBinaryString
        println("0" * (8 - int.length) + int + ".0000")
      }
    }
    loop()
  }
  def power(base: Int, exp: Int): Int = {
    exp match {
      case 0 ⇒ 1
      case 1 ⇒ base
      case _ ⇒ power(base * base, exp / 2) * power(base, exp % 2)
    }
  }
}
