#C11474. Smallest Mirrored Palindrome
Smallest Mirrored Palindrome
Smallest Mirrored Palindrome
You are given a positive integer (n). Your task is to compute the smallest mirrored palindrome with exactly (n) digits. A mirrored palindrome is a number that remains the same when its digits are replaced according to the mirror mapping: (0 \to 0), (1 \to 1), (6 \to 9), (8 \to 8), and (9 \to 6), and then the result is reversed. Note that for (n = 2) the answer is defined as 69
even though other two-digit palindromes exist. For (n = 1), the output is 0
. For (n \ge 3), the smallest mirrored palindrome is given by
[
1\underbrace{0\cdots0}_{n-2}1
]
which is a 1 followed by (n-2) zeroes and ending with a 1.
inputFormat
Input is read from standard input and consists of a single line containing a positive integer (n) ((1 \le n)).
outputFormat
Output to standard output the smallest mirrored palindrome with exactly (n) digits as described above.## sample
1
0