#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[1000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
void solve(int,int);
int main(){
  double n,sn;
  while(1){
    cin >> n;
    if(n==-1.0) break;
    sn = n * 16;
    if(sn!=(int)sn || sn>=4096) cout << "NA";
    else solve((int)sn,0);
    cout << endl;
  }
}
void solve(int sn,int p){
  if(p == 12) return;
  solve(sn/2,p+1);
  if(p == 3) cout << ".";
  cout << sn % 2;
}
