#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;

double mul[] = {0.0625, 0.125, 0.25, 0.5};

int main(){
  double x;

  while(cin >> x, x != -1){
    int a = (int)floor(x);

    if(a >= (1 << 8)){
      cout << "NA" << endl;
      continue;
    }

    int bit = -1;
    double b = x - a;

    for(int i = 0; i < (1 << 4); i++){
      double sum = 0;
      for(int j = 0; j < 4; j++){
        if(!(i & (1 << j))) continue;
        sum += mul[j];
      }
      if(sum == b){
        bit = i;
        break;
      }
    }

    if(bit == -1){
      cout << "NA" << endl;
      continue;
    }

    for(int i = 7; i >= 0; i--){
      cout << (a & (1 << i) ? 1 : 0);
    }
    cout << ".";
    for(int i = 3; i >= 0; i--){
      cout << (bit & (1 << i) ? 1 : 0);
    }
    cout << endl;
  }
}