#include <stdio.h>

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