import java.io.*;
public class AOJ1041
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int j,k,i,b,c,W,N;
		int S[];
		S=new int[1000000];
		for(i=0;;i++){
		String str1 =br.readLine();
		int n=Integer.parseInt(str1);
		if(n==0)
			break;
			for(j=0;j<n/4;j++){
			String str2 =br.readLine();
			int a =Integer.parseInt(str2);
			S[i]=S[i]+a;
			}
		}
		for(k=0;k<i;k++){
			System.out.println(S[k]);
		}
	}
}