a[1] := 1;
a[2] := 1;
i := 3;
sum := 0;
while (a[i] < 1000) do
begin
a[i] := a[i - 1] + a[i - 2];
inc(i);
end;
for j := 1 to i do
sum := sum + a[i];
write(sum);
a[1] := 1;
a[2] := 1;
i := 3;
sum := 0;
while (a[i] < 1000) do
begin
a[i] := a[i - 1] + a[i - 2];
inc(i);
end;
for j := 1 to i do
sum := sum + a[i];
write(sum);