(format t "~a~%"
	(loop with str = (make-string (read) :initial-element #\0)
	   initially (setf (elt str 0) #\1)
	   repeat (read)
	   for s = (1- (read))
	   for c = (read-char)
	   if (or (and (find s ss) (not (eql (elt str s) c)))
		  (and (zerop s) (eql c #\0) (< 1 (length str))))
	   do (return "-1")
	   do (setf (elt str s) c)
	   collect s into ss
	   finally (return str)))