#include <iostream>

using namespace std;

int main(){
  while(1){
  int n,score=0,sum=0;

  cin >> n;
  if(n==0)break;

  for(int i=0;i<(n/4);i++){
    cin>>score;
    sum+=score;
}
  cout << sum<<endl;
  }
  return 0;
}