#include<stdio.h>

int main(){
  int n;
  int i,j;
  int p;
  int point;
  int s[100] = {0};

  for(j = 0;;j++){
    point = 0;
  do{
    scanf("%d",&n);
  }while(n % 4 != 0);

  if(n == 0){break;}

  for(i = 0; i < n/4; i++){
    scanf("%d",&p);
    point += p;
  }

  s[j] = point;
  }

  for(i = 0; i < j; i++){
    printf("%d\n",s[i]);
  }
  return 0;
}
    