#include<stdio.h>

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

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

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

    printf("%d\n", sum);
  }

  return 0;
}