#include <stdio.h>

int main(void){
  int n,a,i,sum;
  scanf("%d",&n);
  while(n){
    sum=0;
    n/=4;
    for(i=0;i<n;i++){
      scanf("%d",&a);
      sum += a;
    }
    printf("%d\n",sum);
    scanf("%d",&n);
  }
  return 0;
}