http://acm.hdu.edu.cn/showproblem.php?pid=1047
/*
2011-9-9
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Scanner;
public class HDU_1047 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
int n = in.nextInt();
while(n-- > 0){
BigInteger bSum = new BigInteger("0");
while(in.hasNext()){
BigInteger bn = in.nextBigInteger();
if(bn.equals(new BigInteger("0"))){
if(n == 0){
System.out.println(bSum);
}else{
System.out.println(bSum);
System.out.println();
}
break;
}
bSum = bSum.add(bn);
}
}
}
}