#include <stdio.h>

int main(void)
{
	int n, p, s;
	int i;

	while (1) {
		s = 0;
		scanf("%d", &n);
		if (n == 0) break;
		for (i = 0; i < n / 4; i++) {
			scanf("%d", &p); s += p;
		}
		printf("%d\n", s);
	}

	return 0;
}