output_description: Print the number of hours that will pass in World A.
  
  The output will be regarded as correct when its absolute or relative error
  from the judge's output is at most 10^{-3}.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      T X
attempt: 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)))
  
problem_description: Statement
  
  In order to pass the entrance examination tomorrow, Taro has to study for T
  more hours.
  
  Fortunately, he can _leap_ to World B where time passes X times as fast as it
  does in our world (World A).
  
  While (X \times t) hours pass in World B, t hours pass in World A.
  
  How many hours will pass in World A while Taro studies for T hours in World B?
samples: [{"input": "8 3", "output": "2.6666666667\n    \n\nWhile Taro studies for eight hours in World B where time passes three times as\nfast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\n* * *"}, {"input": "99 1", "output": "99.0000000000\n    \n\n* * *"}, {"input": "1 100", "output": "0.0100000000"}]