while true
	n = gets.to_i
	break if n == 0

	p, b = 0, "1" + gets.chomp
	sum = add = b.to_i(2)
	while true
		m = ((9007199254740992 - sum) / add.to_f).ceil
		sum += add * [m, n].min
		break if m > n
		sum /= 2
		add /= 2
		p += 1
		n -= m
		break if add == 0 || n == 0
	end
	puts sprintf("%012b", p) + sprintf("%b", sum)[1..-1]
end

