program pil_6_17(input,output);
var
	count : integer;
	c : char;
	result : boolean;
begin
	count := 0;
	read(c);
	result := true;
	while (c<>'.') and result do begin
		if c='(' then count := count + 1;
		if c=')' then count := count - 1;
		if count < 0 then
			result := false;
		read(c);
	end;
	if count<>0 then result := false;
	WriteLn(result);
end.