#include <iostream>
using namespace std;



int main(){
  double power[8]={},sho[5];
  power[0] = 1;  sho[0] = 1;
  for(int i=1;i<8;i++){
    power[i] = power[i-1]*2;
  }
  for(int i=1;i<5;i++){
    sho[i] = sho[i-1]/2;
  }

  while(1){
    double n;
    cin >> n;
    if(n < 0) break;
    int ans[16]={};
    for(int i=0;i<8;i++){
      if(n >= power[7-i]){
	n -= power[7-i];
	ans[i]=1;
      }
    }
    for(int i=0;i<4;i++){
      if(n >= sho[i+1]){
	n -= sho[i+1];
	ans[i+8]=1;
      }
    }
    if(n != 0) cout << "NA\n";
    else{ 
      for(int i=0;i<12;i++){
	cout << ans[i];
	if(i == 7) cout << ".";
      }
      cout << "\n";
    }



  }
}