#include<stdio.h>

int main(){
  int n, i, j = 0, x, total[10000] = {0};

  while(1){
    total[j] = 0;
    scanf("%d", &n);
    if(n == 0)
      break;
    for(i = 0; i < n/4; i++){
      scanf("%d", &x);
      total[j] += x;
    }
    j++;
  }

  for(i=0; i<j; i++)
    printf("%d\n", total[i]);

  return 0;
}

