import std.stdio, std.string, std.conv;
import std.algorithm, std.math;

void main() {
	auto input = getStdin!(string[]);
	
	foreach (line; input) {
		if (line == "0") break;
		line.map!(to!(string)).map!(to!(int)).reduce!"a + b".writeln;
	}
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}