T, N, money = map(int, input().split()) s, p, r = [0] * N, [0] * N, [0] * N def softmax(x): import math # 入力リストから最大値を取得 max_x = max(x) # ソフトマックス関数の計算 exp_x = [e - max_x for e in x] exp_x = [math.exp(e) for e in exp_x] softmax_values = [e / sum(exp_x) for e in exp_x] return softmax_values def do(arg): if type(arg) == list: print(1, *arg, flush=True) else: print(2, arg, flush=True) money = int(input()) if money == -1: exit() s = list(map(int, input().split())) p = list(map(int, input().split())) r = list(map(int, input().split())) return money, s, p, r money, s, p, r = do([money // (500 * N)] * N) for week in range(T - 1): pay = [p * s for p, s in zip(p, softmax(money))] if sum(pay) > money: pay = [p * money / sum(pay) for p in pay] money, s, p, r = do(pay)