1
121
12321
1234321
123454321
...
a = int(input())
total = 0
j = 1
b = 0
for i in range(1, a + 1):
j = 1
total += 1
if total != 1:
b = str(j)
while j != total:
j += 1
b += str(j)
while total != 1:
total -= 1
b += str(j)
b = int(b) - 1
print(b)
else:
print(1)