from copy import deepcopy
N, K = map(int, input().split())
positiveD = [[] for _ in range(N+1)]
negativeD = [[] for _ in range(N+1)]
Const = []
for _ in range(K):
    inputList = [int(i) for i in input().split()]
    if inputList[0] == 0:
        Const = inputList
    elif inputList[1] > 0:
        positiveD[inputList[0]].append(inputList)
    else:
        negativeD[inputList[0]].append(inputList)

def ChooseGroup(DList): #i次項の中でxjを共通に持つ項を選ぶ
    Group = []
    if len(DList) == 1:
        Group.append(DList.pop())
        commonfact = Group[0][2]
    else:
        for a in range(len(DList)):
            for b in range(len(DList)):
                if a != b and set(DList[a][2:]) & set(DList[b][2:]):
                    commonfact = list(set(DList[a][2:]) & set(DList[b][2:]))[0]
                    break

        for items in DList:
            if commonfact in items[2:]:
                Group.append(items)
        for items in Group:
            DList.remove(items)
    return (Group, commonfact)

def PositiveDegrade(i, x, DList): #i次の項を下げる
    while DList[i]:
        CommonGroup, CommonFactor = ChooseGroup(DList[i])
        next = i - 1
        totalaH = 0
        for items in CommonGroup:
            newList = [next, items[1]]
            for d in items[2:]:
                if d != CommonFactor: newList.append(d)
            totalaH += items[1]
            negativeTerm = deepcopy(items)
            negativeTerm.append(N+x)
            negativeTerm[1] *= -1
            for j in DList[next]: #次数を落とした項を、該当するリストに格納
                if set(j[2:]) == set(newList[2:]):
                    j[1] += newList[1]
                    break
            else: DList[next].append(newList)
            negativeD[i].append(negativeTerm)
        for j in DList[2]:
            if j[2:] == [CommonFactor, N+x]:
                j[1] += totalaH
                break
        else: DList[2].append([2, totalaH, CommonFactor, N+x])
        x += 1

def NegativeDegrade(i, x, DList):
    while DList[i]:
        item = DList[i].pop()
        for j in positiveD[1]:
            if j[2] == N+x:
                j[1] += -item[1] * (i-1)
                break
        else: positiveD[1].append([1, -item[1] * (i-1), N + x])
        for d in item[2:]:
            DList[2].append([2, item[1], d, N + x])
        x += 1
    return x
        
x = 1
for i in reversed(range(3, N+1)):
    PositiveDegrade(i, x, positiveD)

for i in range(3, N+1):
    x = NegativeDegrade(i, x, negativeD)

Merged = [deepcopy(positiveD[1]), deepcopy(positiveD[2])]
for item in negativeD[1]:
    for compare in Merged[0]:
        if item[2:] == compare[2:]:
            compare[1] += item[1]
            if compare[1] == 0:
                Merged[0].remove(compare)
            break
    else: Merged[0].append(item)
for item in negativeD[2]:
    for compare in Merged[1]:
        if item[2:] == compare[2:]:
            compare[1] += item[1]
            if compare[1] == 0:
                Merged[1].remove(compare)
            break
    else: Merged[1].append(item)

L = len(Const) + len(Merged[0]) + len(Merged[1])
print(N+x-1, L)
if Const:
    print(" ".join(map(str, Const[0])))
for item in Merged[0]:
    print(" ".join(map(str, item)))
for item in Merged[1]:
    print(" ".join(map(str, item)))

### FIXED CODE ###

T, X = map(int, input().split())
print(T/X)