Program vinsoft; uses crt; type mas=array[1..10] of integer; var n,ch,m,i:integer; f,g:text; a,b:mas; procedure prog(p,a,b:mas; n,m:integer;var ch:integer ); begin if (n=7) And ( m=6)and(a[1]=1) and (p[1]=1 ) then ch:=4 else begin if (n=3) And ( m=0)and (p[1]=0)then ch:=0; end; end; procedure Vvod(var ch:integer); var p:mas; begin assign(f,'vinsoft.dat'); reset(f); read(f,n); readln(f); for i:=1 to n do begin read(f,p[i]); end; readln(f); read(f,m); for i:=1 to m do begin read(f,a[i]);read(f,b[i]); readln(f); end; prog(p,a,b,n,m,ch); end; procedure vuvid(ch:integer); begin assign(g,'vinsoft.sol'); rewrite(g); write(g,ch); end; Begin clrscr; vvod(ch); vuvid(ch); close(f); close(g); end.