#include <stdio.h>

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