var n, k: integer;
    a: array[0..100000] of integer;
    i, j: integer;
    x: integer;
    s, sminn: integer;
begin
readln(n);
for i := 0 to n do
    readln(a[i]);
readln(k);

sminn := 1000 * 1000000;
for i := 1 to n + 1 - k do
begin
    s := 0;
    for j := i to i + k - 2 do
        s := s + a[j];
    if s < sminn then
        sminn := s;
end;
writeln(sminn);
end.