#include<iostream>

using namespace std;

int main(){
  double in;
  while(cin >> in){
    if(in == -1) break;

    double dec;
    dec = in - (int)in;
    in = (int)in;

    int data[12];
    int div = 128;
    for(int i = 0; i < 8; i++){
      if(in >= div){
	data[i] = 1;
	in -= div;
      }else data[i] = 0;
      div /= 2;
    }
    double divd = 0.5;
    for(int i = 8; i < 12; i++){
      if(dec >= divd){
	data[i] = 1;
	dec -= divd;
      }else data[i] = 0;
      divd /= 2;
    }

     if(in || dec){
      cout << "NA" << endl;
      continue;
      }

    for(int i = 0; i < 8; i++) cout << data[i];
    cout << ".";
    for(int i = 8; i < 12; i++) cout << data[i];
    cout << endl;
  }
  return 0;
}