with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;

procedure main is
   x: Integer;
begin
   for i in 0..4 loop
      get(x);
      if (x = 0) then put(i + 1, 0);
      end if;
   end loop;
end main;