Preparing a knapsack problem

Read t up to 1e18 and print k = 300 with sixty 1s plus extra elements chosen by greedy binomial decomposition so exactly t subsets sum to 300.

Easy3CombinatoricsImplementationNo attempts yetTime limit1sMemory limit32 MB

Problem

Making test data is a large part of setting a problem. There is no fixed recipe for it. For each problem you list the wrong answers that solvers are likely to write, then prepare data that catches them.

Consider the following problem.

A multiset S={a1,a2,,an}S = \{a_1, a_2, \dots, a_n\} is given. How many subsets of SS have element sum exactly kk? Two elements with the same value but different positions count as different.

The constraints are 1n3001 \le n \le 300 and 1k3001 \le k \le 300, and every element of SS is a natural number no greater than kk.

One wrong answer for it prints t1t - 1 on data whose true answer is tt. To catch that answer you need a program that takes a natural number tt and produces a multiset SS and a natural number kk whose answer is exactly tt. Write that program.

Many data sets satisfy the condition, so only the one built by the method given in the output section is accepted.

Input

The first line contains a natural number tt. (1t10181 \le t \le 10^{18})

Output

On the first line print nn and kk, separated by a space. On the second line print a1,a2,,ana_1, a_2, \dots, a_n in nondecreasing order, separated by spaces. nn, kk and SS must satisfy the constraints above.

Build the data by this method only.

  1. Set k=300k = 300.
  2. Put 60 elements of value 1 into SS.
  3. Set r=tr = t. While r>0r > 0, take the largest integer dd with 0d300 \le d \le 30 and (60d)r\binom{60}{d} \le r, put one element of value 300d300 - d into SS, then subtract (60d)\binom{60}{d} from rr.
  4. nn is the total number of elements put into SS.

Each element added in step 3 lies in exactly (60d)\binom{60}{d} subsets of sum 300, and every subset of sum 300 contains exactly one element added in step 3. The answer for this data is therefore exactly tt. For t1018t \le 10^{18} the value of nn never exceeds 242.