http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=1&problemid=3004
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n;
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int s = 0;
n = in.nextInt();
if (n == 0) {
break;
}
while (n-- > 0) {
s += in.nextInt();
}
System.out.println(s);
}
}
}