uses testlib;

const eps=1e-8;

var a:array[1..2,1..1000] of real;
    b:array[1..2,1..1000] of longint;
    n:array[1..2] of integer;  
    i,j:integer;
    s:array[1..2] of extended;
    ss:array[1..2] of longint;
                             
begin
for j:=1 to 2 do begin
  s[j]:=0;
  n[j]:=inf.readinteger;
  if (n[j]<1) or (n[j]>1000) then quit(_fail,'Bad test N');
  for i:=1 to n[j] do begin
    a[j,i]:=inf.readreal;
    s[j]:=s[j]+a[j,i];
    end;
  end;
if abs(s[1]-s[2])>eps then quit(_fail,'inintially is not equation');

for j:=1 to 2 do begin
  ss[j]:=0;
  for i:=1 to n[j] do begin
    b[j,i]:=ouf.readlongint;
    if abs(a[j,i]-round(a[j,i]))<eps then begin  {A - celoe}
       if abs(a[j,i]-b[j,i])>eps then quit(_WA,'Celoe cislo okrugleno ne tuda');
    end
    else begin
      if abs(a[j,i]-b[j,i])>1 then quit(_WA,'Cislo okrugleno neverno');
      end;
    ss[j]:=ss[j]+b[j,i];
    end;
  end;
if ss[1]<>ss[2] then quit(_WA,'Posle okrugleniya poluchilos ne ravenstvo');


quit(_OK,'');

{***********Dlya ligi B - OK*************}

if abs(ss[1]-s[1])>0.5+eps then quit(_WA,'Vsya summa ne minimalno otlichaetsya ot ishodnoy');
quit(_OK,'');
end.



  

