#include <cstdio>
#include <cstring>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define W(i, j) ((i) ? (j) : 0)

using namespace std;

int main(){
  double a;
  while(scanf("%lf", &a) && a > 0){
    bool f = false;
    rep(i, 2) rep(j, 2) rep(k, 2) rep(l, 2) rep(m, 2) rep(n, 2) rep(o, 2) rep(p, 2) rep(q, 2) rep(r, 2) rep(s, 2) rep(t, 2)
      if(W(i,128)+W(j,64)+W(k,32)+W(l,16)+W(m,8)+W(n,4)+W(o,2)+W(p,1)+W(q,0.5)+W(r,0.25)+W(s,0.125)+W(t,0.0625) == a){
	printf("%d%d%d%d%d%d%d%d.%d%d%d%d\n",i,j,k,l,m,n,o,p,q,r,s,t);
	f = true;
      }
    if(!f) puts("NA");
  }
  return 0;
}