#include<iostream>

using namespace std;

int main(){

  int n;
  int tekityu;
  int total[100]={0};
  int count=0;  

  while(cin>>n,n){
    
    for(int i=0;i<n/4;i++){
      cin>>tekityu;
      total[count]+=tekityu;
    }
    
    count++;

  }
  
  for(int i=0;i<count;i++)
    cout<<total[i]<<endl;

  return 0;

}