#include<stdio.h>

int main(){

  int n, sum, i, in;

  while(1){

    scanf("%d",&n);
    
    if(n == 0){
      
      break;
    }
    
    sum = 0;
    
    for(i = 0; i < n/4; i++){
      
      scanf("%d",&in);
      sum += in;
    }
    
    printf("%d\n",sum);
  }
  
  return 0;
}