#include<stdio.h>
int main(){
  int n,i,j=0,m=0,a[1000] = {},k;

  while(1){

    scanf("%d",&n);
    if(n == 0)break;
    
    for(i = 0;i < (n/4);i++){
      scanf("%d",&m);
      a[j] += m;
    }
    j++;

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