#include<stdio.h>
int main(){
  int n,m[10000],i,sum;
  while(1){
    sum=0;
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n/4;i++){
      scanf("%d",&m[i]);
      sum+=m[i];
    }
    printf("%d\n",sum);
  }
  return 0;
}
  