Bobo gets a bipartite graph with n vertices (that is, a graph without odd cycles).
He colors each vertex into black or white, and then calculates the product of each edge's value. The value of an edge is determined by the colors of its two end points. Thus, there can be 2×2=4 different values associated to a given edge.
Now bobo would like to know the sum of products of all 2n possible coloring, modulo (109+7).
The first line contains 2 integers n,m which denotes the number of vertices and edges (2≤n≤40, 1≤m≤100).
Vertices are numbered by 1,2,…,n for convenience.
Each of the following m lines contains 6 integers a_i,b_i,v_i,00,v_i,01,v_i,10,v_i,11, which denotes an edge between vertices a_i and b_i (1≤a_i,b_i≤n,0≤v_i,00,v_i,01,v_i,10,v_i,11≤109).
A single integer denotes the sum.