#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N;
    while (cin >> N, N) {
        int a, sum = 0;
        for (int i = 0; i < N/4; i++) {
            cin >> a;
            sum += a;
        }
        cout << sum << endl;
    }
    return 0;
}