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
#include <bits/stdc++.h>
using namespace std;
long long xyp(long long x, long long y) {
  if (y == 0) return 1LL;
  if (y == 1) return x;
  if (y % 2) {
    long long p = xyp(x, y - 1);
    return (x * p) % 1000000007;
  }
  long long p = xyp(x, y / 2);
  return (p * p) % 1000000007;
}
long long inv(long long x) { return xyp(x, 1000000007 - 2); }
long long fact[10000007];
long long pr[10000007];
vector<long long> rp;
void init() {
  fact[0] = 1;
  for (long long i = 1; i < 10000007; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
}
long long ncr(long long n, long long r) {
  if (r == 0 || n == r) return 1LL;
  if (r == 1 || ((n - r) == 1)) return n;
  long long p =
      (((fact[n] * inv(fact[r])) % 1000000007) * inv(fact[n - r])) % 1000000007;
  return p;
}
void sieve() {
  memset(pr, 1, sizeof(pr));
  pr[0] = pr[1] = 0;
  for (long long i = 2; i < 10000007; i++) {
    if (pr[i]) {
      rp.push_back(i);
      for (long long j = i * i; j < 10000007; j += i) {
        pr[j] = 0;
      }
    }
  }
}
vector<long long> a[100005];
long long bl[100005];
long long n;
long long dp[100005][2];
void dfs(long long v, long long pv) {
  dp[v][0] = 1 - bl[v];
  dp[v][1] = bl[v];
  for (auto x : a[v]) {
    if (x == pv) continue;
    dfs(x, v);
    long long wd = dp[v][0];
    dp[v][0] = 0;
    long long bd = dp[v][1];
    dp[v][1] = 0;
    dp[v][0] = ((wd * dp[x][1]) % 1000000007 + (wd * dp[x][0]) % 1000000007) %
               1000000007;
    dp[v][1] = (((bd * dp[x][1]) % 1000000007 + (bd * dp[x][0]) % 1000000007) %
                    1000000007 +
                (wd * dp[x][1]) % 1000000007) %
               1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 1; i < n; i++) {
    long long x;
    cin >> x;
    a[i].push_back(x);
    a[x].push_back(i);
  }
  for (long long i = 0; i < n; i++) {
    cin >> bl[i];
  }
  dfs(0, 0);
  cout << dp[0][1] << "\n";
  return 0;
}
