#include <iostream>
using namespace std;

#define IPS 1e-10

int main() {
    double n, d;
    int b[12];

    while (cin >> n) {
        if (n < 0) break;
        if (255.9375 < n) goto NA;
        fill(b, b+12, 0);
        d = 128;
        for (int i = 0; n > IPS && i < 12; i++) {
            b[i] = n / d;
            n -= b[i] * d;
            d *= 0.5;
        }
        
        if (n > IPS) goto NA;
        for (int i = 0; i < 12; i++) {
            cout << b[i];
            if (i == 7) cout << '.';
        }
        cout << endl;
        continue;

        NA:
        cout << "NA" << endl;
    }
    return 0;
}