I have written an algorithm, for the task at hand. Here's its condition: Valera the Horse has an integer n. Also Valera has hooves. It is difficult to write with hooves, so Valera can only write the numbers one ("1") and two ("2").
Now Valera wants to find a positive integer which will divide by 2n without remainder and at the same time will contain exactly n digits in the decimal notation. Of course, the decimal notation of this number must not contain any digits except ones and twos.
Help Valera, find and print the required number.
Input data The first line contains an integer n (1 ≤ n ≤ 50) - Valera's number.
Output data Print a positive integer in decimal notation consisting of n digits, which will be divisible by 2n. The decimal notation of this number can contain only ones and twos.
It is guaranteed that an answer exists. If more than one answer exists, it is allowed to output any answer.
Examples Input example 1 Output example 2
Here's my solution:
from itertools import product
n = int(input())
for p in product("12", repeat=n):
res = ''.join(p)
if len(res) == n and int(res) % (n*2) == 0:
print(res)
break
Please point out where my mistake is