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

int main(){
	double n;
	int nn,a[12];
	while(1){
		cin >> n;
		if(n < 0.0) break;
		if(n > 256.0) {
			cout << "NA" << endl;
			continue;
		}
		nn = (int)round(n * 16.0);
		if(abs((double)nn - n * 16.0) > 0.00001) {
			cout << "NA" << endl;
			continue;
		}
		for(int i = 11;i >= 0;i--){
			a[i] = nn % 2;
			nn /= 2;
		}
		for(int i = 0;i < 12;i++){
			cout << a[i];
			if(i == 7) cout << ".";
		}
		cout << endl;
	}
	return 0;
}