#!/usr/bin/env python3
import sys
import random

n = int(sys.argv[1])
q = int(sys.argv[2])
maxa = int(sys.argv[3])
maxk = int(sys.argv[4])
seed = int(sys.argv[5])

import math

random.seed(seed)

print(n, q)
a = []
for _ in range(n):  
    a.append(random.randint(1, maxa))
print(*a)

for _ in range(q):
    # small: Logarithmic sampling to bias k towards smaller values
    k = int(2 ** random.uniform(math.log2(2) if maxk >= 2 else 0, math.log2(maxk)))
    print(k)

