Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"math"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	two := make([]float64, 12)
	flag := make([]int, 12)
	for i := 0; i < 12; i++ {
		two[i] = math.Pow(2.0, 7.0-float64(i))
	}
	for scanner.Scan() {
		n, _ := strconv.ParseFloat(scanner.Text(), 64)
		if n < 0 {
			break
		}
		for i := 0; i < 12; i++ {
			flag[i] = 0
			if n >= two[i] {
				n -= two[i]
				flag[i] = 1
			}
		}
		if n < 10e-10 {
			i := 0
			for i < 12 {
				fmt.Printf("%d", flag[i])
				if i == 7 {
					fmt.Printf(".")
				}
				i++
			}
			fmt.Printf("\n")
		} else {
			fmt.Println("NA")
		}
	}
}

C++: #include<iostream>
#include<algorithm>
 
int main(){
    float f;
    while( std::cin>>f, f>=0){
        int i=f;
        f=f-i;
        if( i>255 ){std::cout<<"NA"<<std::endl;continue;}
        int Fnum=(1<<4)*f;
        if( Fnum != (1<<4)*f ){std::cout<<"NA"<<std::endl;continue;}
        int count=8;
        while( count-- )
            std::cout<<((i&(1<<count))==0?'0':'1');
        std::cout<<'.';
         
        count=4;
        while( count-- )
            std::cout<<((Fnum&(1<<count))==0?'0':'1');
         
        std::cout<<std::endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>

int main(){
	float f;
	while( std::cin>>f, f>=0){
		int i=f;
		f=f-i;
		if( i>255 ){std::cout<<"NA"<<std::endl;continue;}
		int Fnum=(1<<4)*f;
		if( Fnum != (1<<4)*f ){std::cout<<"NA"<<std::endl;continue;}
		int count=8;
		while( count-- )
			std::cout<<((i&(1<<count))==0?'0':'1');
		std::cout<<'.';
		
		count=4;
		while( count-- )
			std::cout<<((Fnum&(1<<count))==0?'0':'1');
		
		std::cout<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string to(int n,int digit){
	string ans;
	while( max(0,digit--) || n)
		ans += n%2 + '0', n /= 2;
	reverse(ans.begin(),ans.end());
	return ans;
}
int main(){
	double num;
	while(cin >> num , num >= 0){
		double a = (int)num , b = num - a;
		if( a < 256 && b < 16){
			cout << to(a,8) << "." << to(b*16,4) << endl;
		}else{
			cout << "NA" << endl;
		}
	}
}

C++: #include<iostream>
#include<map>
#include<sstream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

string compute(int n,bool &flag){
  string ret ="";
  while(n>0){
    if (n%2 == 1)ret+="1";
    else ret+="0";
    n/=2;
  }
  if (ret.size() > 8){
    flag=false;
    return "";
  }
  flag=true;
  while(ret.size() != 8)ret+="0";
  reverse(ret.begin(),ret.end());
  return ret;
}

void makeall(map<string,string> &M){
  const int aho[4]={5000,2500,1250,625};
  rep(i,(1<<4)){
    int val=0;
    rep(j,4){
      if ( (i&(1<<j)) != 0)val+=aho[j];
    }
    stringstream sin;
    sin<<val;
    string key;
    sin>>key;
    while(key.size() != 4)key="0"+key;
    string ret="";
    rep(j,4){
      if ( (i&(1<<j)) != 0)ret+="1";
      else ret+="0";
    }
    //    cout << key <<" " << ret << endl;
    M[key]=ret;
 }
}
/*
string compute2(int m,bool &flag){
  const int aho[4]={5000,2500,1250,625};
  rep(i,(1<<4)){
    //cout << i << endl;
    int val=0;
    rep(j,4){
      if ( (i&(1<<j)) != 0)val+=aho[j];
    }
    cout << val << endl;
    if (val == m){
      string ret="";
      rep(j,4){
	if ( (i&(1<<j)) != 0)ret+="1";
	else ret+="0";
      }
      flag=true;
      return ret;
    }
  }
  flag=false;
  return "";
}
*/

main(){
  int n,m;
  char dummy;
  string in;
  map<string,string> M;
  makeall(M);
  while(getline(cin,in)){
    bool isper=false;
    int m=0;
    int cnt=0;
    string ahoge="";
    rep(i,in.size()){
      if (in[i] == '.'){
	isper=true;
	in[i]=' ';
      }else if (isper){
	ahoge+=in[i];
      }
    }
    while(ahoge.size() != 4)ahoge+="0";
    
    stringstream sin(in);
    sin>>n;
    if (n < 0)break;


    
    bool flag;
    string a=compute(n,flag);
    if (!flag){
      cout << "NA" << endl;
      continue;
    }
    //    cout << ahoge << endl;
    if (M.find(ahoge) != M.end())cout << a << "." << M[ahoge] << endl;
    else cout << "NA" << endl;
  }
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;


double tempd = 0.0;



void input() {
	while (true) {
		CI tempd;
		if (tempd < 0.0) {
			break;
		}
		num.push_back(tempd);
	}

	return;
}


int main(void) {
	double deci;
	int numd;
	vector<int> int_array;
	vector<int> deci_array;
	input();

	for (int i = 0; i < num.size(); i++) {
		numd = num[i];
		deci = num[i] - (double)numd;
		
		while (true) {
			if (numd == 0) {
				break;
			}
			int_array.push_back(numd % 2);
			numd /= 2;
		}
		if (int_array.size() > 8) {
			CO "NA" E
			int_array.clear();
			int_array.shrink_to_fit();
			deci_array.clear();
			deci_array.shrink_to_fit();
			continue;
		}
		 
		bool flag = false;
		int nx = 0;
		while (true) {
			if (deci == (double)(int)deci) {
				break;
			}
			nx++;
			deci *= 2;
			deci_array.push_back((int)deci % 10);
		
		
			if (deci_array.size() > 4) {
				CO "NA" E
				int_array.clear();
				int_array.shrink_to_fit();
				deci_array.clear();
				deci_array.shrink_to_fit();
				flag = true;
				break;
			}
		}
		if (flag)break;
		

		for (int j = 0; j < 8 - int_array.size(); j++) {
			CO 0;
		}
		for (int j = int_array.size() - 1; j >= 0; j--) {
			CO int_array[j];
		}
		CO ".";
		for (int j = 0; j < deci_array.size(); j++) {
			CO deci_array[j];
		}
		for (int j = 0; j < 4 - nx; j++) {
			CO 0;
		}
		CO "\n";
		int_array.clear();
		int_array.shrink_to_fit();
		deci_array.clear();
		deci_array.shrink_to_fit();
	}


	return 0;
}