begin i := 0; f1 := 1; f := 2; thn := -1; s := 1; s1 := 0; repeat i := i + 1; s1 := s; thn := thn * -3; s := s + 2 * i / f / thn; writeln(2 * i, ' ', f, ' ', thn, ' ', s); t := f1; f1 := f; f := f + t until abs(abs(s1) - abs(s)) < e; writeln(s); end.
e = 0.000001;
var
i, f, f1, thn, t: integer;
s, s1: real;
begin
i := 0;
f1 := 1;
f := 2;
thn := -1;
s := 1;
s1 := 0;
repeat
i := i + 1;
s1 := s;
thn := thn * -3;
s := s + 2 * i / f / thn;
writeln(2 * i, ' ', f, ' ', thn, ' ', s);
t := f1;
f1 := f;
f := f + t
until abs(abs(s1) - abs(s)) < e;
writeln(s);
end.