#!/usr/bin/ruby
while(l=gets.chomp)[0..0]!='-'do
	a,b=l.split('.')
	if !b then b='0' end
	if b.size>4 then raise "b.size #{b.size}" end
	while b.size<4 do b+='0' end
	a=a.to_i;b=b.to_i
	if a>255 || b%625>0 then puts 'NA';next end
	printf("%08b.%04b\n",a,b/625)
end