Program RefSimul;

var
  f: text;
  i,j,k,h,s,n,t,dos,tres: integer;
  si,no: array[1..3] of integer;
  p: real;

begin
  Assign(f, 'revocat.dat');
  Reset(f);
  dos:=0; tres:=0;
  Randomize;

  while (not eof(f)) do begin
    readln(f,h,n,s);
    t:=n+s;
    if (t>1100) then begin
      p:=n/t;
      for i:=1 to 3 do begin si[i]:= 0; no[i]:= 0 end;
      for i:=1 to t do begin
         j:= random(3)+1;
         if random < p then no[j]:= no[j] + 1
                       else si[j]:= si[j] + 1;
      end;
      if (si[1]=si[2]) and (si[2]=si[3]) then tres:=tres+1
      else if (si[1]=si[2]) or (si[2]=si[3]) or (si[1]=si[3])
           then dos:=dos+1;
    end;
  end;
  Close(f);
  writeln;
  writeln('dos iguales: ',dos,' tres iguales: ',tres);
end.
