#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

bool t[2000000];

int main(){
	
	int n, m, sum;
	
	while(true){
		cin >> n;
		if(n == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < n / 4; i++){
			cin >> m;
			sum += m;
		}
		printf("%d\n", sum);
	}
	
	return 0;
}