Under construction

Still being built. Things may change

Preparing a knapsack problem

Time limit1sMemory limit32 MB

Summary
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.
Level

Easy3 of 10

Topics
Combinatorics, Implementation
Solved
No attempts yet

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 1≤n≤3001 \le n \le 300 and 1≤k≤3001 \le k \le 300, and every element of SS is a natural number no greater than kk.

One wrong answer for it prints t−1t - 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. (1≤t≤10181 \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 0≤d≤300 \le d \le 30 and (60d)≤r\binom{60}{d} \le r, put one element of value 300−d300 - 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 t≤1018t \le 10^{18} the value of nn never exceeds 242.

Examples3

  1. Example 1

    Input
    1
    
    Expected output
    61 300
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 300
    
  2. Example 2

    Input
    3
    
    Expected output
    63 300
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 300 300 300
    
  3. Example 3

    Input
    17
    
    Expected output
    77 300
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300