
import std.stdio, std.conv, std.math, std.array, std.algorithm, std.string;

string show(int[] arr) {
  return arr.map!(to!(string)).join("");
}

void main() {
  double num;
  while(readf("%f\n", &num), num >= 0.0) {
    int integer;
    double dec;
    int[] dec_arr, integer_arr;

    dec = num - floor(num);
    integer = floor(num).to!(int);

    // 整数部の変換
    for(int i = 0; i < 8; i++) {
      integer_arr ~= (integer & 1);
      integer >>= 1;
    }

    // 小数部の変換
    for(int i = 0; i < 4; i++) {
      dec *= 2;
      dec_arr ~= dec.to!(int);
      dec = dec - floor(dec);
    }

    if (dec == 0 && integer == 0) {
      writeln(integer_arr.reverse.show, ".", dec_arr.show);
    }
    else {
      writeln("NA");
    }
  }
}