#C9547. Look-and-Say Sequence Generator

    ID: 53652 Type: Default 1000ms 256MiB

Look-and-Say Sequence Generator

Look-and-Say Sequence Generator

In this problem, you are asked to generate the n-th term of the look-and-say sequence. The sequence starts with 1, and each subsequent term is generated by describing the previous term in terms of the number of consecutive digits. For example, the first term is 1, the second term is 11 (read as "one 1"), the third term is 21 (read as "two 1s"), the fourth term is 1211 (read as "one 2, then one 1") and so on.

More formally, let ( a_1 = 1 ) and for ( n \ge 2 ), ( a_n ) is obtained by reading the digits of ( a_{n-1} ) and stating the number of digits in groups followed by the digit itself. Your task is to implement a function that, given an integer n, outputs the n-th term of this sequence.

inputFormat

The input consists of a single integer ( n ) (where ( 1 \le n \le 20 )), provided as standard input (stdin).

outputFormat

Output the n-th term of the look-and-say sequence as a string to standard output (stdout).## sample

1
1