#include <stdio.h>
int main (){
  int n,i,a[1000],sum;

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