def function(string):
summ = 0
lst = [int(i) for i in string]
for i in lst:
summ += i
# print(summ)
string = str(summ)
if len(string) != 1:
function(string)
return summ
numbers = '456789'
print(function(numbers))