import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int sum;
		while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		}
	}
	static int[] parseInts(char[] c){
		int[] x = new int[c.length];
		for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		}
		return x;
	}
} import java.io.*; io.* java class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int sum;
		while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		}
	}
	static int[] parseInts(char[] c){
		int[] x = new int[c.length];
		for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		}
		return x;
	}
} Main public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int sum;
		while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int sum;
		while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int sum; sum while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		} true {
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		} sum=0 sum 0 String str = br.readLine(); str br.readLine() br.readLine br char[] cr = str.toCharArray(); cr str.toCharArray() str.toCharArray str int[] in = parseInts(cr); in parseInts(cr) parseInts cr for(int i=0;i<in.length;i++){
				sum += in[i];
			} int i=0; int i=0; i 0 i<in.length i in.length in in.length i++ i++ i {
				sum += in[i];
			} {
				sum += in[i];
			} sum += in[i] sum in[i] in i if(sum==0) break; sum==0 sum 0 break; System.out.println(sum) System.out.println System.out System System.out sum String[] args args static int[] parseInts(char[] c){
		int[] x = new int[c.length];
		for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		}
		return x;
	} parseInts {
		int[] x = new int[c.length];
		for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		}
		return x;
	} int[] x = new int[c.length]; x new int[c.length] c.length c c.length for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		} int i=0; int i=0; i 0 i<c.length i c.length c c.length i++ i++ i {
			x[i] = Character.getNumericValue(c[i]);
		} {
			x[i] = Character.getNumericValue(c[i]);
		} x[i] = Character.getNumericValue(c[i]) x[i] x i Character.getNumericValue(c[i]) Character.getNumericValue Character c[i] c i return x; x char[] c c
import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int sum;
		while(true){
			sum=0;
			String str = br.readLine();
			char[] cr = str.toCharArray();
			int[] in = parseInts(cr);
			for(int i=0;i<in.length;i++){
				sum += in[i];
			}
			if(sum==0) break;
			System.out.println(sum);
		}
	}
	static int[] parseInts(char[] c){
		int[] x = new int[c.length];
		for(int i=0;i<c.length;i++){
			x[i] = Character.getNumericValue(c[i]);
		}
		return x;
	}
}