#include "testlib.h"

const int N = 1'000;

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

    int smallN = atoi(argv[1]);
    int smallM = atoi(argv[2]);
    std::string smallField(argv[3]);
    int max_rand = atoi(argv[4]);

    std::cout << 1 << std::endl;
    std::cout << N << ' ' << N << std::endl;

    int sx = rnd.next(0, N - smallN);
    int sy = rnd.next(0, N - smallM);
    int tx = sx + smallN;
    int ty = sy + smallM;
    std::vector<std::string> a(N, std::string(N, '.'));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            if (i >= sx && i < tx && j >= sy && j < ty) {
                int x = i - sx;
                int y = j - sy;
                int pos = x * smallM + y;
                a[i][j] = smallField[pos];
            } else {
                if (rnd.next(0, max_rand) == 0) {
                    a[i][j] = '.';
                } else {
                    a[i][j] = '#';
                }
            }
        }
    }

    for (int i = 0; i < N; ++i) {
        std::cout << a[i] << std::endl;
    }


    return 0;
}