#include<iostream>
using namespace std;

int main()
{
	int n;
	while (cin >> n&&n > 0) {
		int a, maxsum = 0;
		for (int i = 0;i < n;++i) {
			cin >> a;
			if (a > 0) {
				maxsum += a;
			}
		}
		cout << maxsum << endl;
	}
}