#include <iostream>

using namespace std;

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