#include <iostream>

using namespace std;

void solve()
{
	int N;
	while(cin >> N, N)
	{
		int sum = 0;
		int n = N / 4;
		int temp;
		for(int i = 0; i < n; ++i)
		{
			cin >> temp;
			sum += temp;
		}
		cout << sum << endl;
	}
}

int main()
{
	solve();
	return(0);
}