#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
//#include<string.h>
//#include<time.h>
//#include<ctype.h>
//#define pi acos(-1.0)
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define S(type,x) fscanf(stdin,"%"#type,&x)
//#define MAX(a,b) a>b?a:b
//#define MIN(a,b) a<b?a:b
int main() {
	int ans, n;
	for (; fscanf(stdin, "%d", &n), n; P(d, ans)) {
		ans = 0;
		int i, a;
		for (i = 0; i < n / 4; i++)  S(d, a),ans +=a;
	}
	return 0;
}