#include <iostream>
#include <string>

using namespace std;

typedef long long BigInt;
int main() {
  double n;
  while (true) {
    cin >> n;
    if (n < 0) {
      return 0;
    }
    if ((n * 16) - BigInt(n * 16) == 0 and n < (1 << 8)) {
      for (int i = 0; i < 8; ++i) {
        cout << ((BigInt(n) & (1 << (7 - i))) > 0? 1: 0);
      }
      cout << ".";
      for (int i = 0; i < 4; ++i) {
        cout << ((BigInt(n * (2 << i)) & 1) > 0? 1: 0);
      }
      cout << endl;
    } else {
      cout << "NA" << endl;
    }
  }
}