#include<bits/stdc++.h>
using namespace std;

string Z(int m){
    if(m>=(1<<8))return "";
    string ret;
    for(int i=7;i>=0;i--){
        if((m>>i)&1)ret+="1";
        else ret+="0";
    }
    return ret;
}

string R(double r){
    double table[]={1.0/2,1.0/4,1.0/8,1.0/16};
    string ret;
    for(int i=0;i<4;i++){
        if(r>=table[i]){
            r-=table[i];
            ret+="1";
        }
        else ret+="0";
    }
    if(r!=0)return "";
    return ret;
}


int main(){

    double n;
    while(cin>>n,n!=-1){
        int m=(int)n;
        double r=n-m;

        if(Z(m)!=""&&R(r)!=""){
            cout<<Z(m)+"."+R(r)<<endl;
        }
        else cout<<"NA"<<endl;
    }
    return 0;
}