# 最初の入力 T, N, money = map(int, input().split()) ADV = 500000 S = [0] * N P = [0] * N R = [0] * N D = [1] * N # インタラクティブ for week in range(T): # (あ) 出版社の行動を出力する if False and week <= T//2 and money >= ADV*3: print("2", 2, flush=True) else: P_sum = 0 for i in range(N): P[i] += 5 P_sum += max(P[i], 0) L = [] for i in range(N): if P[i] <= 0: L.append(0) continue ratio = P[i]/P_sum if week <= 20: m = max(0, min(10-R[i],int(money*ratio)//10//500)) L.append(m) else: a = min(R[i], int(R[i]**2*D[i]*1.05**P[i])) m = max(0, a, min(10-R[i],int(money*ratio)//10//500)) if sum(l*500 for l in L) >= money: L = [0]*N print("1", *L, flush=True) # (い) 売上部数などを入力する money = int(input()) S = list(map(int, input().split())) if S[0] == -1: exit() P = list(map(int, input().split())) R = list(map(int, input().split()))