import sys #a = [[4, 2, 0, 0, 0, 0], [3, 2, 1, 1, 0, 0], [5, 2, 1, 2, 0, 0], [6, 2, 0, 3, 0, 0], [7, 2, 4, 4, 0, 0]] #a=[[价格,重要度,主件编号,序号,主件附件标记,附件数量]] p, m = map(int, input().split()) p = p // 10 a = sys.stdin.readlines() for i, x in zip(range(m), a): a[i].rstrip() a[i] = list(map(int, x.spl...