#include <stdio.h>

int main(){

  int i;
  int n = 0;
  int count = 0;
  int a;

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

    for(i = n / 4; i >= 1; i--){
      scanf("%d", &a);
      count = count + a;
    }

    printf("%d\n", count);
    count = 0;
  }


  return 0;
}