#P7859. Product(无SPJ)

Product(无SPJ)

Product

Problem Description

You are given a prime pp. For a number aa, you need to find positive integers x1,x2,,xkx_1, x_2, \dots, x_k such that xia(modp)\prod x_i \equiv a \pmod p, and xi2500\sum x_i\leq 2500. Output any valid solution.

Input

The first line contains a prime p(1p1018)p (1\leq p \leq 10^{18}), pp is chosen uniformly and randomly from [0.9×1018,1018][0.9\times 10^{18}, 10^{18}]. The second line contains a integer q(1q100)q (1\leq q\leq 100). Each line of the following qq lines contains an integer a(1ap1)a (1\leq a\leq p-1), aa is chosen from [1,p1][1, p-1] uniformly and randomly.

Output

Output qq lines for each number. In each line, prine kk first, then x1,x2,,xkx_1, x_2, \dots, x_k.

Sample Input

178187
3
6
100
109065

Sample Output

2 2 3
1 100
2 1000 1000

Source

2020 Multi-University Training Contest 9