#include <stdio.h>
int main(void) {
  int n, m, i, total = 0, mato;
  scanf("%d", &n);
  while(n != 0) {
    total = 0;
    m = n /4;
    for(i = 0; i < m; i++){
      scanf("%d", &mato);
      total = total + mato;
    }
    printf("%d\n", total);
    total = 0;
    scanf("%d", &n);
  }
  return 0;
}