#include <stdio.h>

int sum;

void deal_dataset(int n)
{
    int i, t;

    for (sum = 0, i = 0; i < n / 4; i++) {
	scanf("%d", &t);
	sum += t;
    }
}

int main()
{
    int hit, n;
    while (1) {
	if (n == 0)
	    return 0;
	else
	    scanf("%d", &n);

	deal_dataset(n);

	printf("%d\n", sum);
    }
    return 0;
}