#include <iostream>
using namespace std;

int main(void){
  double x;

  while(cin>>x, x!=-1){
    int dec = x;
    double flo = x - dec;

    string decStr = "";
    while(dec != 0){
      if(dec % 2 == 0){
        decStr = '0' + decStr;
      }
      else{
        decStr = '1' + decStr;
      }

      dec /= 2;
    }

    string floStr = "";
    int cnt = 0;

    while(cnt < 4 && flo != 0){
      flo *= 2;
      if(flo >= 1){
        floStr += '1';
        flo -= 1;
      }
      else{
        floStr += '0';
      }
      cnt++;
    }

    if(flo != 0 || decStr.length() > 8){
      cout<<"NA\n";
    }
    else{
      while(decStr.length() != 8) decStr = '0' + decStr;
      while(floStr.length() != 4) floStr += '0';
      cout<<decStr<<"."<<floStr<<endl;
    }
  }

  return 0;
}