#include <stdio.h>

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