#include <stdio.h>

int main(void) {
	int n=0;
	int x=0;
	int sum=0;
	while( scanf("%d",&n),n!=0){
	int i=0;
	sum=0;
	for(i=0;i<n/4;++i){
		scanf("%d",&x);
		sum=sum+x;
	}
	printf("%d\n",sum); }
	
	// your code goes here
	return 0;
}