#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	double kaga,laura;
	int d[13];
	while(cin>>kaga){
		if(kaga<0)break;
		laura=128;
		for(int i=1;i<=12;i++,laura*=0.5){
			d[i]=0;
			if(kaga>=laura){
				d[i]=1;
				kaga-=laura;
			}
		}
		if(kaga==0){
			for(int i=1;i<=12;i++){
				cout<<d[i];
				if(i==8)cout<<".";
			}
			cout<<endl;
		}
		else cout<<"NA"<<endl;
	}
	return 0;
}
