#include<iostream>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int sum = 0;
		for (int i = 0; i < n / 4; i++) {
			int a;
			cin >> a;
			sum += a;
		}
		cout << sum << endl;
	}
}