import sequtils,strutils,algorithm,math,sugar,macros,strformat import sets,tables,intsets,queues,heapqueue,bitops template get*():string = stdin.readLine().strip() macro unpack*(arr: auto,cnt: static[int]): auto = let t = genSym(); result = quote do:(let `t` = `arr`;()) for i in 0.. S[v]: (u,v) = (v,u) if S[v] - S[u] != 1 : continue case S[v]: of 1 : ans[v] += 1 of 2 : DC &= (u,v) else : CA &= u for dc in DC: ans[dc[1]] += ans[dc[0]] echo CA.mapIt(ans[it]).sum() mod 1000000007