#include <stdio.h>

int main() {

  int n;
  int a,b,c,d;
  int i,j,k,l;

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

  for(i = 0; i< n/4; i++) {
     scanf("%d",&a);

    b = b + a;
  }

  printf("%d\n",b);

  }

}