/*
	AOJ_0220:Binary Digit A Doctor Loved
*/
#include	<iostream>
#include	<string>

using namespace std;

string convert_toDigit(double);

int main(void) {
	double input;

	while (1) {
		cin >> input;

		if (input < 0.0) { break; }
		cout << convert_toDigit(input) << endl;
	}
	return 0;
}

string convert_toDigit(double targetNum) {
	string ans;
	double progressNum = 128.0;

	while (progressNum > 0.03125) {

		if (targetNum >= progressNum) {
			ans += '1';
			targetNum -= progressNum;
		} else {
			ans += '0';
		}
		progressNum /= 2;
		if (progressNum == 0.5) { ans += '.'; }
	}
	if (targetNum == 0.0) { return ans; }
	else { return "NA"; }
}