City United
시간 제한3초메모리 제한512 MB
모든 간선이 거리 13 이내의 두 정점을 잇는 그래프에서 연결된 정점 부분집합의 개수를 2로 나눈 나머지를 구한다.
문제
In ICPCCamp there are cities which are conveniently labeled with . There are also bidirectional roads: the -th road connects cities and .
Bobo chooses a non-empty subset of cities to form a union. For each two cities and in the union, there must exist a path from to passing through no cities outside the union. In other words, the union must be connected.
Bobo would like to know how many ways there are to choose such a subset, but he is afraid of large numbers. Therefore, he just wants to find this number modulo .
입력
The first line contains two integers and (, ).
The -th of the following lines contains two integers and (, ).
출력
Output an integer which denotes the number of possible subsets modulo .