procedure readch;
var i;
begin
  read(i);
  if i # 0 then call readch;
  write(i)
end;

begin
  call readch
end.