#include <stdio.h>

int main()
{
    int sum, i, n, t;
    while (1) {
	scanf("%d", &n);
	if (n == 0)
	    return 0;

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