import scala.io.StdIn.{readInt,readLine}

object Main {
  def toBinaryString(d:Double,cnt:Int,s:String):String = {
    if(d==0D) "0"
    else if(cnt>4) "NA"
    else {
      val d2 = d*2D
      if(d2 == 1D) s+"1"
      else if(d2>1D) toBinaryString(d2-1D,cnt+1,s+"1")
      else toBinaryString(d2,cnt+1,s+"0")
    }
  }

  def main(args:Array[String]) = {
    Iterator.continually(readLine).takeWhile(_.trim.toDouble >= 0.0 ).foreach { s =>
      val d = s.trim.toDouble
      val d1 = d.toInt.toBinaryString
      val d2 = d-d.toInt
      val d2tob = toBinaryString(d2,0,"")

      if(d2tob=="NA") println("NA")
      else if(d2tob.length>4) println("NA")
      else if(d1.length>8) {
        println("NA")
      } else {
        println(("0"*(8-d1.length))+d1+"."+d2tob+("0"*(4-d2tob.length)))
      }
    }
  }
}