#include <bits/stdc++.h>
using namespace std;
int main() {
	double num;
	while(cin>>num,num>0){
	    string str;
		for(double i=128;i>0.03125;i/=2){
			str+=int(num/i)+'0';
			if(num/i>=1)num-=i;
			if(i==1)str+='.';
		}
		if(num/0.03125>0)cout<<"NA"<<endl;
		else cout<<str<<endl;
	}
}