#python3

import sys
num_empty = int(sys.argv[1])
start = int(eval(sys.argv[2]))
num = int(sys.argv[3])
length = int(sys.argv[4])

assert num_empty < length, "num empty too big"

MOD = 27171923
seed = (num_empty * 17 + start * 19 + length * 15) % MOD

ans = [("%0" + str(length) + "d") % (x % 10**length) for x in range(start, start + num)]
inp = [["*"] * length for x in range(num)]
for column in range(length - num_empty):
    seed = (seed * 17 + 13) % MOD
    k = seed % num + 1
    for iter in range(k):
        seed = (seed * 17 + 13) % MOD
        pos = seed % num
        inp[pos][column] = ans[pos][column]

print(num, length)
for s in inp:
    print("".join(s))

