#include <stdio.h>

int main(void){
	int n,i,tekn;
	int buf,sum;
	while(1){
		scanf("%d",&n);
		if(n == 0){break;}
		tekn = n / 4;
		sum = 0;
		for(i = 0; i < tekn; i++){
			scanf("%d",&buf);
			sum += buf;
		}
		printf("%d\n",sum);
	}


	return 0;
}