#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){

	int n,limit,sum,tmp;
	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		sum = 0;
		limit = n/4;

		for(int i=0; i < limit;i++){
			scanf("%d",&tmp);
			sum += tmp;
		}
		printf("%d\n",sum);
	}

    return 0;
}