We all know that (kn)=1⋅2⋅…⋅(k−1)⋅kn⋅(n−1)⋅…⋅(n−k+2)⋅(n−k+1) is an integer number for any 0≤k≤n. But it would be nice if we could prove it by providing a matching between factors in numerator and denominator, wouldn't it?
Let's build a bipartite graph with k vertices in each part. The i-th vertex in the left part corresponds to factor (n+1−i) from numerator and j-th vertex in the right part corresponds to factor j from denominator. There is an edge i --- j if and only if j divides (n+1−i). The number k is provable for n if there is a perfect matching in this bipartite graph.
Given n, check if k is provable for each k satisfying 0≤k≤n.
The only line contains one integer n (0≤n≤1018).
Print string of length (n+1) consisting of '0' and '1', (k+1)-th character should be '1' if and only if k is provable for n.
What, you think this will get Output Limit Exceeded? Hmmmm... Okay. Let's compress the string.
Let s_0=“0” and s_1=“1”. You can define s_2,s_3,…,s_t. String s_i should be a concatenation of several earlier defined strings. Formally, ∀:i:(2≤i≤t):s_i=s_j_1+s_j_2+…+s_j_k_i, here 1≤k_i, ∀:r:(1≤r≤k_i):j_r<i. String s_t should be the answer to the problem.
In the first line print one integer t (2≤t≤500).
In the next t−1 lines print the descriptions of s_i. Each description should have a form k_i:j_1:j_2:…:j_k_i, with 1≤k_i and 0≤j_r<i.
Total length of all descriptions should not exceed 10,000: ∑_i=2tk_i≤10,000.
We can show that for all valid tests there exists a way to construct the answer string abiding all the limitations. If there are several possible ways to do so, print any one of them. Note that you don't have to minimize t or total length of all descriptions.
In the third sample: s_2=s_1+s_1="‘1‘"+"‘1‘"="‘11‘", s_3=s_1+s_2+s_0+s_0="‘1‘"+"‘11‘"+"‘0‘"+"‘0‘"="‘11100‘", s_4=s_3+s_1+s_2="‘11100‘"+"‘1‘"+"‘11‘"="‘11100111‘",