Under construction

Still being built. Things may change

Partitions

Time limit2sMemory limit512 MB

Summary
Find the smallest set of distinct positive integers with exactly k splits where one part's LCM equals the other part's GCD, given as prime factorizations.
Level

Hard9 of 10

Topics
Number theory, Combinatorics, Math
Solved
No attempts yet

Problem

Brian has found the Legendary Set of Numbers, a fabled set of positive integers said to have mysterious properties. Being a very kind person, he decides to share the set with his two closest friends, Abhilash and Kevin. He has known them for a long time, and they squabble at the least provocation, so he needs to split the set in an equitable way.

Abhilash loves the LCM, or least common multiple. The LCM of a set is the smallest positive integer divisible by all of its elements. Kevin loves the GCD, or greatest common divisor. The GCD of a set is the largest positive integer that divides all of its elements.

Brian wants to partition the set into two parts such that the LCM of the part given to Abhilash equals the GCD of the part given to Kevin. He quickly finds such a partition in the Legendary Set of Numbers. Playing around more, he realizes there are exactly 4242 ways to do so!

Brian thinks this is no coincidence, since this is the Legendary Set of Numbers. He wonders whether it is the smallest set with exactly 4242 partitions where the LCM of one part is the GCD of the other. He also asks about other counts. Specifically, what is the smallest nn such that some set of nn distinct positive integers can be partitioned in exactly kk ways where the LCM of one part is the GCD of the other?

Brian also asks you to supply such a set as proof. Since the numbers may get large, give each one as its prime factorization, with the numbers in sorted increasing order.

A partition of a set SS is a pair of nonempty sets AA and BB with A⊂SA \subset S, B⊂SB \subset S, A∪B=SA \cup B = S, and A∩B=∅A \cap B = \emptyset. For k=1k = 1, the smallest set is {1,4,5}\{1, 4, 5\}. Its only partition is {1}\{1\} and {4,5}\{4, 5\}, where the LCM of {1}\{1\} and the GCD of {4,5}\{4, 5\} are both 11.

Input

The input is a single line containing one integer kk (1≤k≤1041 \leq k \leq 10^4).

Output

Output one line with the integer nn, the smallest size of a set as described above.

Then output nn lines. The iith line describes the iith smallest number in the set. Each line has the form f p1 q1 p2 q2 … pf qff\ p_1\ q_1\ p_2\ q_2\ \dots\ p_f\ q_f, where adjacent numbers are separated by a space. Here ff is the number of distinct prime factors of the number, and for 1≤i≤f1 \leq i \leq f, pip_i is a prime factor and qiq_i is its multiplicity. The values must satisfy 0≤f≤1030 \leq f \leq 10^3, 2≤pi≤2⋅1032 \leq p_i \leq 2 \cdot 10^3, and 1≤qi≤1051 \leq q_i \leq 10^5.

Examples1

  1. Example 1

    Input
    1
    
    Expected output
    3
    0
    1 2 2
    1 5 1