#include <stdio.h>

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