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 "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"



string to_string_keta(const long long int l, const int keta) {
	ostringstream oss;

	oss << std::setw(keta) << std::setfill('0') << l;

	return oss.str();
}
int main() {
	while (1) {
		string st; cin >> st;
		if (st[0] == '-')break;
		string up = st.substr(0, st.find('.'));
		string down = st.substr(st.find('.') + 1);
		if (down != "0") {

			while (!down.empty() && down.back() == '0') down.pop_back();
		}
		if (stoi(up)< 0)break;
		else {
			int ap = stoi(up);
			if (ap >= powint(2, 8)) {
				cout << "NA" << endl;
				continue;
			}
			else {
				string ans;
				for (int i = 7; i >= 0; --i) {
					if (ap >= powint(2, i)) {
						ans.push_back('1');
						ap -= powint(2, i);
					}
					else {
						ans.push_back('0');
					}
				}
				ans.push_back('.');
				bool ok = false;
				for (int i = 0; i <= 15; ++i) {
					int ast = 625 * i;
					string aast = to_string_keta(ast, 4);
					while (!aast.empty()&&aast.back() == '0') aast.pop_back();
					if (aast.empty())aast = "0";
					if (aast == down) {
						ok = true;
						int num = i;
						for (int j = 3; j >=0; --j) {
							if (num >= powint(2, j)) {
								ans.push_back('1');
								num -= powint(2, j);
							}
							else {
								ans.push_back('0');
							}
						}
					}
				}
				if (!ok) {
					cout << "NA" << endl;
					continue;
				}
				else {
					cout << ans << endl;
				}
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;

int main(){
    double n;
    while(1){
        cin >> n;
        if(n < 0)   break;
        
        double integer;
        n = modf(n, &integer);
      
        int left = round(integer);
        
        if(left > 255){
            cout << "NA" << endl;
            continue;
        }
        
        int resinteger[8] = {};
        for(int i = 7; i >= 0; i--){
            resinteger[i] = left%2;
            left /= 2;
        }
        
        int resfloat[4] = {};
        double now = 0.5;
        for(int i = 0; i < 4; i++){
            if(n >= now){
                resfloat[i] = 1;
                n -= now;
            }
            now /= 2.0;
        }
        
        if(n == 0){
            for(int p : resinteger) cout << p;
            cout << ".";
            for(int p : resfloat)   cout << p;
            cout << endl;
        }else{
            cout << "NA" << endl;
        }
    }
    return 0;
}

C++: using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int main()
{
	double num;
	while(cin>>num&&num>=0){
		num*=1<<4;
		if(num!=(double)(int)num||(int)num>=(1<<12)){
			cout<<"NA"<<endl;
		}else{
			int n=(int)num;
			for(int i=11;i>=0;i--){
				printf((n>>i)&1?"1":"0");
				if(i==4)printf(".");
			}
			printf("\n");
		}
	}
    return 0;
}

C++: #include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[1000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
void solve(int,int);
int main(){
  double n,sn;
  while(1){
    cin >> n;
    if(n==-1.0) break;
    sn = n * 16;
    if(sn!=(int)sn || sn>=4096) cout << "NA";
    else solve((int)sn,0);
    cout << endl;
  }
}
void solve(int sn,int p){
  if(p == 12) return;
  solve(sn/2,p+1);
  if(p == 3) cout << ".";
  cout << sn % 2;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;

int main()
{
	string str;
	while (cin >> str) {
		if (str[0] == '-') break;
		
		if (str.find('.') == string::npos) {
			puts("NA");
			continue;
		}
		
		string A = str.substr(0, str.find('.'));
		string B = str.substr(str.find('.') + 1, str.size());
		
		bool ok = true;
		int ans[12] = {};
				
		if (A[0] == '0') {
			int z = 0;
			while (A[z] == '0') z++;
							
			if (z == A.size()) A = "0";
			else A = A.substr(z);
		}
		
		if (*(B.end() - 1) == '0') {
			int z = B.size() - 1;
			while (z >= 0 && B[z] == '0') z--;
			z++;
			
			if (z == 0) B = "0";
			else B = B.substr(0, z);
		}
		
		if (B.size() > 5) ok = false;
		if (A.size() > 5) ok = false;
		
		if (ok) {
			ll a = atol(A.c_str());
			while (B.size() < 5) B += '0';
			ll b = atol(B.c_str());
			
			REP(i, 8) {
				ans[7 - i] = a % 2;
				a /= 2;
			}
			
			if (a > 0) ok = false;
			else {
			
				REP(i, 4) {
					b *= 2;
					ans[8 + i] = b / 100000;
					b %= 100000;
				}
				
				if (b > 0) ok = false;
			}
		}
		
		if (ok) {
			REP(i, 8) putchar('0' + ans[i]);
			putchar('.');
			FOR(i, 8, 12) putchar('0' + ans[i]);
			puts("");
		}
		else puts("NA");
	}
	return 0;
}


// 5

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#define rep(i,n) for(int i=0;i<(int)n;i++)

using namespace std;


int main()
{
	double a;
	for(cin>>a;a>0.0;cin>>a)
	{
		int j;
		double k;
		string ans,ans2;
		j=a;
		k=a-j;
		while(j!=0)
		{
			ans+=j%2==1?"1":"0";
			j/=2;
		}
		if(ans.size()>8)
		{
			cout<<"NA"<<endl;
			continue;
		}
		else
		{
			while(ans.size()!=8)ans+="0";
		}
		reverse(ans.begin(),ans.end());
		ans+=".";
		
		
		
		
		int i=1;
		while(k>=0.0000001)
		{
			if(k>=(1.0/2.0)/i)
			{
				k=k-(1.0/2.0)/i;
				ans2+="1";
			}
			else
			{
				ans2+="0";
			}
			i++;
			if(ans2.size()>=6)break;
		}
		
		if(ans2.size()>=5)
		{
			cout<<"NA"<<endl;
			continue;
		}
		else
		{
			while(ans2.size()!=4)ans2+="0";
		}
		
		cout<<ans<<ans2<<endl;
		
		
	}
}