We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i.
Consider painting each of these edges white or black. There are 2^{N-1} such ways to paint the edges. Among them, how many satisfy all of the following M restrictions?

* The i-th (1 \leq i \leq M) restriction is represented by two integers u_i and v_i, which mean that the path connecting Vertex u_i and Vertex v_i must contain at least one edge painted black.

Constraints

* 2 \leq N \leq 50
* 1 \leq a_i,b_i \leq N
* The graph given in input is a tree.
* 1 \leq M \leq \min(20,\frac{N(N-1)}{2})
* 1 \leq u_i < v_i \leq N
* If i \not= j, either u_i \not=u_j or v_i\not=v_j
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
:
a_{N-1} b_{N-1}
M
u_1 v_1
:
u_M v_M


Output

Print the number of ways to paint the edges that satisfy all of the M conditions.

Examples

Input

3
1 2
2 3
1
1 3


Output

3


Input

2
1 2
1
1 2


Output

1


Input

5
1 2
3 2
3 4
5 3
3
1 3
2 4
2 5


Output

9


Input

8
1 2
2 3
4 3
2 5
6 3
6 7
8 6
5
2 7
3 5
1 6
2 8
7 8


Output

62
#包除原理
#辺の保持をbit演算での保持へ変換するのが辛い
n = int(input())

TE = [[] for _ in range(n)]
TE2 = []
for i in range(n-1):
    ai,bi = map(int, input().split( ))
    ai -= 1
    bi -= 1
    TE[ai].append(bi)
    TE[bi].append(ai)
    TE2.append((ai,bi))
m  = int(input())
D =[]
for i in range(m):
    ai,bi = map(int ,input().split( ))
    ai -= 1
    bi-=1
    D.append((ai,bi))

bit = 1<<m


P =[0]*n
C = [[] for _ in range(n)]
from collections import deque
Q = deque()
Q.append(0)
V = [0]*n
V[0] = 1

while Q:
    v = Q.popleft()
    for u in TE[v]:
        if not V[u]:
            V[u] = 1
            Q.append(u)
            P[u] = v
            C[v].append(u)
def path(u,v):
    u_p = set()
    tmp1 = u
    while tmp1:
        u_p.add(tmp1)
        tmp1 = P[tmp1]
    u_p.add(tmp1)
    tmp2 = v

    while tmp2 not in u_p:
        tmp2 = P[tmp2]
    pth = 0##
    tmp3 = u
    tmp4 = v
    while tmp3!=tmp2:
        for t in range(n-1):
            if TE2[t] == (tmp3,P[tmp3]) or TE2[t]==(P[tmp3],tmp3):
                pth |= (1<<t)
        tmp3 = P[tmp3]

    while tmp4!= tmp2:
        for t in range(n-1):
            if TE2[t] == (tmp4,P[tmp4]) or TE2[t]==(P[tmp4],tmp4):
                pth |= (1<<t)
        tmp4 = P[tmp4]
    return pth

D2 = [path(D[i][0],D[i][1]) for i in range(m)]
#print(D2)
ans = 2**(n-1)
for i in range(1,bit):
    cnt = 0
    paths = 0
    for j in range(m):
        if (i>>j)&1:
            paths |= D2[j]
            cnt += 1
    cnt2 = 0
    for j in range(n-1):
        cnt2 += (paths>>j)&1
    ans += (-1)**cnt *2**(n-1-cnt2)
print(ans)
