#include<stdio.h>
int main(){
  while(1){
  int total, kaisuu;
  int i=1;
  int score, nowscore=0;
  scanf("%d",&total);
      if(total==0){
	break;
      }
  kaisuu=total/4;
    while(i <= kaisuu){
      scanf("%d",&score);
      nowscore += score;
	i++;
    }
	printf("%d\n",nowscore);
  }
      return 0;
}