#include<stdio.h>

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