#include<iostream>

bool ans[12];
double b[12]={128,64,32,16,8,4,2,1,0.5,0.25,0.125,0.0625};
double n;

void solve(){
	for(int i=0; i<12; i++){
		if(n-b[i] >= 0){
			n -= b[i];
			ans[i] = true;
		}else
			ans[i] = false;
	}
}

void show(){
	if(n)
		std::cout << "NA";
	else{
		for(int i=0; i<12; i++){
			if(i==8)
				std::cout << '.';
			if(ans[i])
				std::cout << 1;
			else
				std::cout << 0;
		}
	}
	std::cout << std::endl;
}

int main(){
	while(true){
		std::cin >> n;
		if(n<0)
			return 0;
		solve();
		show();
	}
	return 0;
}