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