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