#include<stdio.h>
int main(void){
	int n;
	int i;
	int x;
	int sum = 0;
	while(scanf("%d",&n)){
		if(n == 0){
			break;
		}
		for(i = 0;i < n / 4; i++){
			scanf("%d",&x);
			sum += x;
		}
		printf("%d\n",sum);
		sum = 0;
	}
	return 0;
}