import java.util.*; class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); while(sc.hasNextInt()){ int n = sc.nextInt(); if(n==0){ break; } int t, s= 0; while(n-->0){ t = sc.nextInt(); s = s+t; } System.out.println(s); } }