#include <bits/stdc++.h>
using namespace std;
const long long INF = 1ll << 29;
const long long MOD = 1000000007;
int main() {
  map<int, string> sa, sb;
  for (int i = (0); i < (1 << 8); i++) {
    int sum = 0;
    string now = "";
    for (int j = (0); j < (8); j++) {
      if (i >> j & 1) {
        sum += 1 << j;
        now += '1';
      } else
        now += '0';
    }
    reverse((now).begin(), (now).end());
    sa[sum] = now;
  }
  int tmp[4] = {5000, 2500, 1250, 625};
  for (int i = (0); i < (1 << 4); i++) {
    int sum = 0;
    string now = "";
    for (int j = (0); j < (4); j++) {
      if (i >> j & 1) {
        now += '1';
        sum += tmp[j];
      } else
        now += '0';
    }
    sb[sum] = now;
  }
  string str;
  while (cin >> str) {
    if (str.find('.') == string::npos) {
      if (str[0] == '-') break;
      puts("NA");
      continue;
    }
    string A = str.substr(0, str.find('.'));
    if (atoi(A.c_str()) < 0) break;
    string B = str.substr(str.find('.') + 1, str.size());
    bool ok = true;
    int ans[12] = {};
    while (B.size() < 4) B += '0';
    int a = atoi(A.c_str()), b = atoi(B.c_str());
    if (sa.find(a) == sa.end() || sb.find(b) == sb.end())
      puts("NA");
    else
      cout << sa[a] << "." << sb[b] << endl;
  }
  return 0;
}
