#include <stdio.h>

int main(){
  int num,sum,n,i;

  while(1){
    scanf("%d",&n);
    if(n==0) break;

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

  return 0;
}