#include <iostream>
#include <vector>
using namespace std;
int main(){
  while(1){
    int n;
    cin >> n;
    if(n == 0)break;
    int sum = 0;
    
    for(int i = 0;i < n/4;i++){
      int tmp;
      cin >> tmp;
      sum += tmp;
    }
    cout << sum << endl;
  }
  return 0;
}