#include <stdio.h>

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