import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class TestsGen implements Runnable {
    public static void main(String[] args) {
        if (args.length < 1) {
        	for (I = 1; (new File(getName(I) + ".t")).exists(); I++);
        } else {
            I = Integer.parseInt(args[0]);
        }
        new Thread(new TestsGen()).start();
    }

    PrintWriter out;

    Random rand = new Random(64395786L);

    static int I;

    static String getName(int i) {
    	return ((i < 10) ? "0" : "") + i;
    }
    
    void open() {
        try {
        	System.out.println("Generating test " + I);
            out = new PrintWriter(getName(I));
        } catch (FileNotFoundException e) {        	
        	e.printStackTrace();
        	System.exit(-1);
        }
    }

    void close() {
        out.close();
        I++;
    }


    String randString(int len, String alpha) {
        StringBuilder ans = new StringBuilder();
        int k = alpha.length();
        for (int i = 0; i < len; i++) {
            ans.append(alpha.charAt(rand.nextInt(k)));
        }
        return ans.toString();
    }


    int rand(int l, int r) {
    	return l + rand.nextInt(r - l + 1);
    }
    
    long rand(long l, long r) {
    	return l + (rand.nextLong() >>> 1) % (r - l + 1);
    }
    
    final int MAX_N = 1000;
    final int MAX_A = 1000000;
    
    void genRandTest(int n) {
    	open();
    	out.println(n);
    	for (int i = 0; i < n; ++i) {
    		out.print((i > 0 ? " " : "") + rand(0, (long)MAX_A));
    	}
    	out.println();
    	close();
    }
    
    void genPosTest(int n) {
    	open();
    	out.println(n);
    	long sum = 0;
    	for (int i = 0; i < n - 1; ++i) {
    		long a = rand(0, (long)MAX_A);
    		sum = (sum + a) % n;
    		out.print(a + " ");
    	}
    	long a = rand(1, (long)MAX_A / n);
    	out.println(a * n - sum);
    	close();
    }
    
    
    void genBigAns(int n) {
    	open();
    	out.println(n);
    	int[] a = new int[n];
    	a[rand(0, n - 1)] = MAX_A / n * n;
    	for (int i = 0; i < n; ++i) {
    		out.print((i > 0 ? " " : "") + a[i]);
    	}
    	out.println();
    	close();
    }
    
    void genZero(int n, int a) {
    	open();
    	out.println(n);
    	for (int i = 0; i < n; ++i) {
    		out.print((i > 0 ? " " : "") + a);
    	}
    	out.println();
    	close();
    }
    
    
    
    public void solve() throws IOException {
    	genZero(7, MAX_A);
    	for (int i = 0; i < 2; ++i) {
    		genRandTest(rand(5, 10));
    		genPosTest(rand(5, 10));
    	}
    	for (int i = 0; i < 2; ++i) {
    		genRandTest(rand(50, 100));
    		genPosTest(rand(50, 100));
    	}
    	genBigAns(100);
    	genZero(MAX_N, MAX_A);
    	for (int i = 0; i < 4; ++i) {
    		genRandTest(rand(MAX_N / 10 * 9, MAX_N));
    		genPosTest(rand(MAX_N / 10 * 9, MAX_N));
    	}
    	genBigAns(MAX_N);
    	genPosTest(MAX_N);
    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
}
