#include <iostream>
#include <string>

using namespace std;

int main() {
	double d;
	while (cin >> d) {
		if (d < 0.0) {
			break;
		} 
		if (d >= 257.0) {
			cout << "NA" << endl;
		} else {
			int a = d;
			double b = d-a;
			int counter[4] = {0};
			if (b >= 0.5) {
				b -= 0.5;
				counter[0] = 1;
			}
			if (b >= 0.25) {
				b -= 0.25;
				counter[1] = 1;
			}
			if (b >= 0.125) {
				b -= 0.125;
				counter[2] = 1;
			}
			if (b >= 0.0625) {
				b -= 0.0625;
				counter[3] = 1;
			}
			if (b > 0.0) {
				cout << "NA" << endl;
			} else {
				string zo = "01";
				string s = "";
				for (int i = 0; i < 8; i++) {
					s += zo[a%2];
					a/= 2;
				}
				string ss = "";
				for (int i = 7; i >= 0; i--) {
					ss += s[i];
				}
				string dd = "";
				for (int i = 0; i < 4; i++) {
					dd += zo[counter[i]];
				}
				cout << ss << '.' << dd << endl;
			}
		}
	}
	return 0;
}