import random
import sys

maxN = int(sys.argv[1])
pW = float(sys.argv[2])
MAXSTR = int(sys.argv[3])

N = random.randint(0, maxN)
print N
win = random.random() < pW
strength = [random.randint(0, MAXSTR) for i in xrange(2**N)]
if N != 0:
    if win:
        strength[0] = random.randint(min(strength[1:]), MAXSTR)
    else:
        strength[0] = min(strength[1:])

print '\n'.join(map(str, strength))
