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