class Program
{
static void Main(string[] args)
{
string num = Console.ReadLine();
int sum = DigitSum(Convert.ToInt32(num));
Console.WriteLine("sum:{0}", sum);
Console.Read();
}
static private int DigitSum(int num)
{
int sum = 0;
while (num > 0)
{
sum += num % 10;
num /= 10;
}
if (sum > 9)
{
sum = DigitSum(sum);
}
return sum;
}
}