#include <stdio.h>
int main(){
  int n ,i ,arrow ,total=0;
  while( scanf( "%d" ,&n ) ){
    if( n == 0 ){
      break;
    }

    n /= 4;

    for( i=0 ; i<n ; i++ ){
      scanf( "%d" ,&arrow );
      total += arrow;
    }

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

  return 0;
}