/*
 * src.cpp
 *
 *  Created on: 2016/08/04
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const double EPS=1e-10;

#define EQ(a,b) fabs(a-b)<EPS

double r;
double bin[12]={128,64,32,16,8,4,2,1,0.5,0.25,0.125,0.0625};

int out[12];

int main(){
	do{
		cin>>r;
		if (r>=0-EPS){
			fill(out,out+12,0);
			REP(i,12){
				if (r>=bin[i]-EPS){
					r-=bin[i];
					out[i]=1;
				}
			}
			if (EQ(r,0)){
				REP(i,8){
					cout<<out[i];
				}
				cout<<'.';
				REP(i,4){
					cout<<out[i+8];
				}
				cout<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}while (r>=0-EPS);
	return 0;
}