#include <iostream>
#include <vector>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(int argc, char** argv) {
    int n;
    cin >> n;
    vector <int> a;
    for (int i = 0; i < n + 1; i++)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    int k;
    cin >> k;

    int s = 0;
    for (int i = 1; i < k; i++)
          s += a[i];
    int sminn = s;
    for (int i = 1; i <  n - k + 1; i++)
    {
        s -= a[i];
        s += a[i + k - 1];
        sminn = min(sminn, s);
    }
    cout << sminn;

	return 0;
}
