import sequtils,strutils,deques type item = tuple[id : int, oya : seq[int], ko : seq[int]] zairyou = tuple[oya : int, num : int] var N = stdin.readline.parseInt M = stdin.readline.parseInt P,Q,R : int cnt : array[101,int] flag : array[101,bool] Items = newSeq[item](N + 1) hyou : array[101,array[101,int]] p : item j : int for i,t in Items: Items[i] = (i,newSeq[int](0),newSeq[int](0)) cnt[N] = 1 for n in 0.. 0: j = q.popFirst p = Items[j] if cnt[p.id] == 0 or flag[p.id] == false: continue for k in p.ko: cnt[k] += hyou[k][p.id] * cnt[p.id] q.addLast(k) cnt[p.id] = 0 for i in 1..