program perceptronai;
  { 15 olimpiada, II etapas, IX-XII klasës }
   var s1, s2, s3: real;
       d1, d2, rt, r: integer;
begin
  write ('Pradinës S1, S2, S3 reikðmës: ');
  readln (s1, s2, s3);
  write ('Áveskite D1 ir D2: ');
  readln (d1, d2);

  while true do
    begin
      if d1 +d2 = 0
        then rt := 0
        else rt := 1;
      if (d1*s1+d2*s2+s3) >=1
        then r := 1
        else r := 0;
      writeln ('          RT = ', rt, ' R= ', r);
      if Rt = R
         then begin
                write ('Gerai. Áveskite D1 ir D2: ');
                readln (d1, d2);
              end
         else begin
                s1 := s1 + 0.5*(Rt-r)*d1;
                s2 := s2 + 0.5*(Rt-r)*d2;
                s3 := s3 + 0.5*(Rt-r);
                write ('Blogai; S1 = ', s1:2:1, ' s2=',
                       s2:2:1,' s3=', s3:2:1);
              end;
    end;
end.
