Building Spanning Trees
Consider an undirected, complete, simple graph G on vertices. The vertices of G are labeled from to . Specifically, each pair of distinct vertices is connected by a single undirected edge, so there are precisely edges in this graph.
You are given a set E that consists of edges of this graph G. More precisely, you are given two arrays and with elements each. For each valid is one of the edges in E.
A spanning tree of G is a subset of exactly edges of G such that the edges connect all vertices. You may note that the edges of a spanning tree do indeed form a tree that is a subgraph of G and spans all its vertices.
We are interested in spanning trees that contain all of the edges in the provided set E. Find the number of such spanning trees modulo . Two spanning trees are different if there is an edge of G that is in one of them but not in the other.
Input
The first line contains number . The second and the third lines contain arrays and of length each.
Output
Print the number of spanning trees modulo .