AT_abc427_b [ABC427B] Sum of Digits Sequence
Description
For a positive integer $ x $ , define $ f(x) $ as the sum of the digits in the decimal representation of $ x $ . For example, $ f(123) = 1 + 2 + 3 = 6 $ .
Define an infinite sequence $ A = (A_0, A_1, A_2, \ldots) $ by the following formula:
- $ A_0 = 1 $
- For $ i \geq 1 $ , $ A_i = \displaystyle\sum_{j = 0}^{i - 1} f(A_j) $
You are given a positive integer $ N $ . Find the value of $ A_N $ .
Input Format
The input is given from Standard Input in the following format:
> $ N $
Output Format
Print the answer.
Explanation/Hint
### Sample Explanation 1
- $ A_0 = 1 $
- $ A_1 = f(A_0) = 1 $
- $ A_2 = f(A_0) + f(A_1) = 2 $
- $ A_3 = f(A_0) + f(A_1) + f(A_2) = 4 $
- $ A_4 = f(A_0) + f(A_1) + f(A_2) + f(A_3) = 8 $
- $ A_5 = f(A_0) + f(A_1) + f(A_2) + f(A_3) + f(A_4) = 16 $
- $ A_6 = f(A_0) + f(A_1) + f(A_2) + f(A_3) + f(A_4) + f(A_5) = 23 $
Thus, $ A_6 = 23 $ .
### Constraints
- $ N $ is an integer between $ 1 $ and $ 100 $ , inclusive.