import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int a ,b=0;
int n;
while(sc.hasNext()) {
n=sc.nextInt();
if(n==0) {
break;
}
else {
b=0;
for (int i=0; i<n; i++) {
a=sc.nextInt();
b+=a;
}
System.out.println(b);
}
}
}
}