Program Zif_6_17(input,output);
var c:char;
    k:integer;
Begin
     k:=0;
     read(c);
     while (c<>'.') and (k>=0) do
     begin
          if c='(' then k:=k+1;
          if c=')' then k:=k-1;
          read(c)
     end;
     write(k=0);
end.