#include <iostream>
#include <string>
#include <sstream>
using namespace std;

double to_f(const string &s) {
    istringstream is(s);
    double d;
    is >> d;
    return d;
}

string binary(int n, int p) {
    string s;
    int r = 1<<(p-1);
    while (r != 0) {
        if (n / r) {
            s.push_back('1');
        } else {
            s.push_back('0');
        }
        n %= r;
        r >>= 1;
    }
    return s;
}

int main() {
    string s;
    while (cin >> s) {
        if (s[0] == '-') break;
        int n; double d;
        n = (int)to_f(s);
        d = to_f(s) - n;
//        cout << n << ' ' << d << endl;

        if (0 <= n && n < (1<<8) && d*16 == (int)(d*16)) {
            cout << binary(n, 8) << '.' << binary(d*16, 4) << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}