def k(): for i in range(1,10): for j in range(1,10):yield int(str(j)*i+"0"*(9-i)+str(j)*i) n=int(input()) print(sum(i