#include <stdio.h>

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