#include <iostream>
#include <algorithm>
//#include <fstream>

using namespace std;

string dec2bin (int n )
{
	string res = "";
	int count = 0;

	while (n > 0 || count < 8){
		res += n % 2 + '0';
		n /= 2;
		++count;
	} // end while
	
	reverse (res.begin(), res.end() );

	return res;
}

string dec2bin_dec (double n )
{
	string res = "";
	double d = 0.5;
	int count = 0;

	while (n > 0.0 || count < 4){
		
		if (n >= d ){
			n -= d;
			res += '1';
		}else{
			res += '0';
		} // end if
		d /= 2.;
		++count;
	} // end while

	return res;
}
int main()
{
//	cut here before submit 
//	freopen ("testcase.binarydigit", "r", stdin );
	double n;

	while (cin >> n && n >= 0.0 ) {
		int    integer = (int)n;
		double decimal = n - (double)integer;
		string resi = dec2bin (integer);
		string resd = dec2bin_dec (decimal );
		
		if (resi.length() > 8 || resd.length() > 4){
			cout << "NA" << endl;
		}else{
			cout << resi << '.' << resd << endl;
		} // end if
	} // end loop
		
	return 0;
}