#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int main(){
	
	double d;
	
	while(true){
		cin >> d;
		if(d < 0){
			break;
		}
		
		double step = 0.0625;
		int ans = -1;
		
		for(double loop = 0; loop < 4096; loop += 1){
			if(d == step * loop){
				ans = loop;
			}
		}
		
		if(ans == -1){
			cout << "NA" << endl;
		}else{
			int dig[12];
			for(int i = 11; i >= 0; i--){
				dig[i] = ans % 2;
				ans /= 2;
			}
			for(int i = 0; i < 8; i++){
				cout << dig[i];
			}
			cout << ".";
			for(int i = 8; i < 12; i++){
				cout << dig[i];
			}
			cout << endl;
		}
		
	}
	
	return 0;
}