#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
	long???long int n,ans = 0;
	while(cin >> n){
		if(n == 0)break;

		long int a[n];

		for(int i = 0;i < n;i++){
			cin >> a[i];
			ans += a[i];
		}
		cout << ans << endl;
	}
}