#include <cstdio>
using namespace std;
int main()
{
    int a, b, n;
    while (scanf("%d", &n), n)
    {
        a = 0;
        while (n--)
            scanf("%d", &b), a += b;
        printf("%d\n", a);
    }
    return 0;
}