1. step[n][m] ์๋ m์ผ๋ก ๋๋๋ n+1์๋ฆฌ ๊ณ๋จ ์์ ๊ฐ์๋ฅผ ์ ์ฅํ ๊ฒ์ด๋ค
2. step[0] = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1] ์ด๋ค. ( ํ์๋ฆฌ ๊ณ๋จ์๋ 1~9 )
3. for๋ฌธ์ ํตํด 2์๋ฆฌ๋ถํฐ n์๋ฆฌ๊น์ง์ ๊ณ๋จ์๋ฅผ ๊ตฌํ๋ค
3-1. n์๋ฆฌ ๊ณ๋จ์๊ฐ 0์ผ๋ก ๋๋๋ ค๋ฉด n-1์๋ฆฌ ๊ณ๋จ์๊ฐ 1๋ก ๋๋์ผํ๋ค
3-2. n์๋ฆฌ ๊ณ๋จ์๊ฐ t(2~8) ๋ก ๋๋๋ ค๋ฉด n-1์๋ฆฌ ๊ณ๋จ์๋ t-1๋ก ๋๋๊ฑฐ๋ t+1๋ก ๋๋์ผ ํ๋ค
3-3. n์๋ฆฌ ๊ณ๋จ์๊ฐ 9๋ก ๋๋๋ ค๋ฉด n-1์๋ฆฌ ๊ณ๋จ์๊ฐ 8๋ก ๋๋์ผํ๋ค
3-4. ๊ณ์ฐํ ๊ฐ ์ซ์๋ก ๋๋๋ ๊ณ๋จ ์๋ฅผ step ๋ฆฌ์คํธ์ ์ถ๊ฐํ๋ค
4. step[n-1] ์ ์ด ํฉ์ 1000000000๋ก ๋๋ ๋๋จธ์ง๋ฅผ ์ถ๋ ฅ
# 10844.py
n = int(input())
step = [[0, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
for i in range(1, n):
n0 = step[i-1][1]
n1 = step[i-1][0] + step[i-1][2]
n2 = step[i-1][1] + step[i-1][3]
n3 = step[i-1][2] + step[i-1][4]
n4 = step[i-1][3] + step[i-1][5]
n5 = step[i-1][4] + step[i-1][6]
n6 = step[i-1][5] + step[i-1][7]
n7 = step[i-1][6] + step[i-1][8]
n8 = step[i-1][7] + step[i-1][9]
n9 = step[i-1][8]
step.append([n0, n1, n2, n3, n4, n5, n6, n7, n8, n9])
print(sum(step[n-1]) % 1000000000)