#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    int q = 1e4;
    cout << q << "\n";

    const long long MAX_T = 100000000LL;

    for (int test = 0; test < q; ++test) {
        long long a[4];

        int small = rnd.next(0, 3);
        if (small != 3) {
            for (int i = 0; i < 4; ++i) {
                a[i] = rnd.next(1, 20);
            }
        } else {
            for (int i = 0; i < 4; ++i) {
                a[i] = rnd.next(1LL, MAX_T);
            }
        }

        long long t;
        bool makeYes = rnd.next(0, 5);

        if (makeYes != 5) {
            int idx = rnd.next(0, 3);
            t = a[idx];

            if (rnd.next(0, 1) && (a[idx] % 2 == 0)) {
                t = a[idx] / 2;
            }

            if (small && rnd.next(0, 4) == 0) {
                int i = rnd.next(0, 3);
                int j = rnd.next(0, 3);
                if (i != j) {
                    long long cand = a[i] + a[j];
                    if (cand <= MAX_T) t = cand;
                }
            }
        } else {
            long long sum = a[0] + a[1] + a[2] + a[3];

            t = rnd.next(sum/2, sum);
        }

        cout << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << " " << t << "\n";
    }

    return 0;
}
