code 32010;
real procedure EULER(AI, I, EPS, TIM);
value EPS, TIM; integer I, TIM; real AI, EPS;
begin integer K, N, T; real MN, MP, DS, SUM; array M[0:15];
    N:= T:= 0; I:= 0; M[0]:= AI; SUM:= M[0] / 2;
NEXT TERM: I:= I + 1; MN:= AI;
    for K:= 0 step 1 until N do 
    begin MP:= (MN + M[K]) / 2; M[K]:= MN; MN:= MP end;
    if ABS(MN) < ABS(M[N]) & N < 15 then 
    begin DS:= MN / 2; N:= N + 1; M[N]:= MN end else DS:= MN;
    SUM:= SUM + DS; T:= if ABS(DS) < EPS then T + 1 else 0;
    if T < TIM then "GO TO" NEXT TERM;
    EULER:= SUM
end EULER;
        eop