Appleman has a tree with n vertices. Some of the vertices (at least one) are colored black and other vertices are colored white.

Consider a set consisting of k (0 ≤ k < n) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it will split into (k + 1) parts. Note, that each part will be a tree with colored vertices.

Now Appleman wonders, what is the number of sets splitting the tree in such a way that each resulting part will have exactly one black vertex? Find this number modulo 1000000007 (109 + 7).

Input

The first line contains an integer n (2 ≤ n ≤ 105) — the number of tree vertices. 

The second line contains the description of the tree: n - 1 integers p0, p1, ..., pn - 2 (0 ≤ pi ≤ i). Where pi means that there is an edge connecting vertex (i + 1) of the tree and vertex pi. Consider tree vertices are numbered from 0 to n - 1.

The third line contains the description of the colors of the vertices: n integers x0, x1, ..., xn - 1 (xi is either 0 or 1). If xi is equal to 1, vertex i is colored black. Otherwise, vertex i is colored white.

Output

Output a single integer — the number of ways to split the tree modulo 1000000007 (109 + 7).

Examples

Input

3
0 0
0 1 1


Output

2


Input

6
0 1 1 0 4
1 1 0 0 1 0


Output

1


Input

10
0 1 2 1 4 4 4 0 8
0 0 0 1 0 1 1 0 0 1


Output

27
// practice with rainboy
import java.io.*;
import java.util.*;

public class CF461B extends PrintWriter {
	CF461B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF461B o = new CF461B(); o.main(); o.flush();
	}

	static final int MD = 1000000007;
	int[] next, jj; int l_ = 1;
	int link(int l, int j) { next[l_] = l; jj[l_] = j; return l_++; }
	int[] ao, xx, dp0, dp1, pp, qq;
	void init(int n, int m) {
		next = new int[1 + m * 2];
		jj = new int[1 + m * 2];
		ao = new int[n];
		xx = new int[n];
		dp0 = new int[n];
		dp1 = new int[n];
		pp = new int[n];
		qq = new int[n];
	}
	void dfs(int i) {
		int x = xx[i], c = 0;
		for (int l = ao[i]; l != 0; l = next[l]) {
			int j = jj[l];
			dfs(j);
			c++;
		}
		if (c == 0) {
			dp0[i] = 1 - x;
			dp1[i] = x;
			return;
		}
		for (int l = ao[i], h = 0; l != 0; l = next[l]) {
			int j = jj[l];
			pp[h] = qq[h] = (dp0[j] + dp1[j]) % MD;
			h++;
		}
		for (int h = 1; h < c; h++)
			pp[h] = (int) ((long) pp[h] * pp[h - 1] % MD);
		for (int h = c - 2; h >= 0; h--)
			qq[h] = (int) ((long) qq[h] * qq[h + 1] % MD);
		if (x == 1) {
			dp1[i] = pp[c - 1];
			dp0[i] = 0;
		} else {
			dp0[i] = pp[c - 1];
			long sum = 0;
			for (int l = ao[i], h = 0; l != 0; l = next[l]) {
				int j = jj[l];
				long p = h == 0 ? 1 : pp[h - 1];
				long q = h == c - 1 ? 1 : qq[h + 1];
				sum = (sum + dp1[j] * p % MD * q) % MD;
				h++;
			}
			dp1[i] = (int) sum;
		}
	}
	void main() {
		int n = sc.nextInt();
		init(n, n - 1);
		for (int j = 1; j < n; j++) {
			int i = sc.nextInt();
			ao[i] = link(ao[i], j);
		}
		for (int i = 0; i < n; i++)
			xx[i] = sc.nextInt();
		dfs(0);
		println(dp1[0]);
	}
}
