#include <stdio.h>

int main()
{

  int n, m, i, a, sum=0;

  while(1){
    sum=0;
    scanf ("%d", &n);
    if( n == 0 ) break;
    a = n /4;
    for ( i = 1; i <=  a; i++ ){
      scanf("%d", &m);
      sum = sum + m;
    }
    printf("%d\n", sum);
  }
  
  return 0;
}