#include <stdio.h>

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