def extract_arguments(fh):
    datasets = []
    while True:
        N = int(fh.readline().strip())
        if N == 0:
            break
        pw = int(fh.readline().strip())
        plants = []
        for _ in range(N):
            vw, pf, vf, th = map(int, fh.readline().strip().split())
            plants.append((vw, pf, vf, th))
        datasets.append((N, pw, plants))
    return datasets

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh: 
#     datasets = extract_arguments(fh)
#     for dataset in datasets:
#         f(*dataset)