import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

}
class TempReaderCall{
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	}
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	static String getStdInRead(BufferedReader br) throws IOException {
		return (br.readLine());
	}
	
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

} Main public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	} main {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in) ); br new BufferedReader(new InputStreamReader(System.in) ) ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0"); al TempReaderCall.getStdInReadlines(br, "0") TempReaderCall.getStdInReadlines TempReaderCall br "0" for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		} int i=0; int i=0; i 0 i < al.size() i al.size() al.size al i++ i++ i {
			System.out.println(sumFromString(al.get(i)));
		} {
			System.out.println(sumFromString(al.get(i)));
		} System.out.println(sumFromString(al.get(i))) System.out.println System.out System System.out sumFromString(al.get(i)) sumFromString al.get(i) al.get al i String[] args args static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	} sumFromString {
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	} int sum = 0; sum 0 for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		} int i=0; int i=0; i 0 i<data.length() i data.length() data.length data i++ i++ i {
			sum += Integer.parseInt(data.substring(i, i+1));
		} {
			sum += Integer.parseInt(data.substring(i, i+1));
		} sum += Integer.parseInt(data.substring(i, i+1)) sum Integer.parseInt(data.substring(i, i+1)) Integer.parseInt Integer data.substring(i, i+1) data.substring data i i+1 i 1 return sum; sum String data data class TempReaderCall{
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	}
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	static String getStdInRead(BufferedReader br) throws IOException {
		return (br.readLine());
	}
	
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
} TempReaderCall static ArrayList<String> getStdInReadlines(BufferedReader br, int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	} getStdInReadlines {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	} ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() for (int i = 0; i < line; i++)
			list.add(br.readLine()); int i = 0; int i = 0; i 0 i < line i line i++ i++ i list.add(br.readLine()); list.add(br.readLine()) list.add list br.readLine() br.readLine br return list; list BufferedReader br br int line line static ArrayList<String> getStdInReadlines(BufferedReader br, String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	} getStdInReadlines {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	} ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() String newdata; newdata do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null); newdata!=null newdata null {
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		} newdata =br.readLine() newdata br.readLine() br.readLine br if (end.compareTo(newdata)==0)
				break; end.compareTo(newdata)==0 end.compareTo(newdata) end.compareTo end newdata 0 break; list.add(newdata) list.add list newdata return list; list BufferedReader br br String end end static String getStdInRead(BufferedReader br) throws IOException {
		return (br.readLine());
	} getStdInRead {
		return (br.readLine());
	} return (br.readLine()); (br.readLine()) br.readLine br BufferedReader br br static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	} splitIntArrayFromString {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	} String[] sts = st.split(" "); sts st.split(" ") st.split st " " int[] data = new int[sts.length]; data new int[sts.length] sts.length sts sts.length for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		} int i=0; int i=0; i 0 i<sts.length i sts.length sts sts.length i++ i++ i {
			data[i] = Integer.parseInt(sts[i]);
		} {
			data[i] = Integer.parseInt(sts[i]);
		} data[i] = Integer.parseInt(sts[i]) data[i] data i Integer.parseInt(sts[i]) Integer.parseInt Integer sts[i] sts i return data; data String st st public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

} public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) 
	throws IOException{
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		ArrayList<String> al = TempReaderCall.getStdInReadlines(br, "0");
		
		for (int i=0; i < al.size(); i++){
			System.out.println(sumFromString(al.get(i)));
		}
	}
	
	static int sumFromString(String data){
		int sum = 0;
		for(int i=0; i<data.length(); i++){
			sum += Integer.parseInt(data.substring(i, i+1));
		}
		
		return sum;			
	}

}
class TempReaderCall{
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, int line) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < line; i++)
			list.add(br.readLine());
		return list;
	}
	
	static ArrayList<String> getStdInReadlines(BufferedReader br, String end) throws IOException {
		ArrayList<String> list = new ArrayList<String>();
		String newdata;
		do{
			newdata =br.readLine();
			if (end.compareTo(newdata)==0)
				break;
			list.add(newdata);
		}while(newdata!=null);
		
		return list;
	}
	
	static String getStdInRead(BufferedReader br) throws IOException {
		return (br.readLine());
	}
	
	
	static int[] splitIntArrayFromString(String st) {
		String[] sts = st.split(" ");
		int[] data = new int[sts.length];
		
		for (int i=0;i<sts.length;i++){
			data[i] = Integer.parseInt(sts[i]);
		}
		
		return data;
	}
}