/* 23 - 35 */

#include <iostream>
#include <algorithm>
using namespace std;

string db(int n){
	string ret;
	for(int i=0;i<8;i++){
		ret+='0'+n%2;
		n/=2;
	}
	reverse(ret.begin(),ret.end());
	
	return ret;
}

string check(double n){
	double table[] = {1.0/2,1.0/4,1.0/8,1.0/16};
	for(int i=0;i<(1<<4);i++){
		double sum = 0;
		string ret = "";
		for(int j=0;j<4;j++){
			if( i & (1<<j) ){
				sum += table[j];
				ret += "1";
			}else{
				ret += "0";
			}
		}
		if(sum == n)return ret;
	}
	return "";
}
int main(){
	double n,dbl;
	
	while(cin >> n , n>=0 ){
		dbl = n-(int)n;
		if( (int)n < (1<<8) && check(dbl) != ""){
			cout << db( (int)n ) << "." << check(dbl) << endl;
		}else{
			cout << "NA" << endl;
		}
			
	}
}