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>
long long shouldendl = 1;
long long INF = (long long)(1e9 + 7);
long long MOD = (long long)(1e9 + 7);
using namespace std;
long long modInverse(long long a) {
  long long m = MOD, m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m, t = m;
    m = a % m, a = t, t = y;
    y = x - q * y, x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long add(long long a, long long b) {
  return ((a % MOD) + (b % MOD)) % MOD;
}
long long mul(long long a, long long b) {
  return ((a % MOD) * (b % MOD)) % MOD;
}
long long sub(long long a, long long b) {
  long long ans = ((a % MOD - b % MOD)) % MOD;
  if (ans < 0) ans += MOD;
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void MAIN(long long i, long long t);
int get(int f = 2) {
  if (f != 2) return 1;
  long long t;
  cin >> t;
  ;
  return t;
}
template <class T>
int logd(T name) {
  cout << name << endl;
  return 0;
}
void test(int t) {
  for (long long i = 1; i <= t; i++) {
    MAIN(i, t);
    if (shouldendl) cout << "\n";
  }
}
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long res = 1;
  x = x % MOD;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return res;
}
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &l, const std::pair<T, U> &r) {
  return {l.first + r.first, l.second + r.second};
}
long long popcnt(long long x) { return __builtin_popcountll(x); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
template <class T>
bool input(vector<T> &v, long long n = -1) {
  if (n == -1) assert(v.size() != 0);
  if (n == -1) n = v.size();
  for (auto &i : v) cin >> i;
  return 0;
}
template <class T>
bool print(vector<T> v, long long l = 0, long long r = -1) {
  if (r == -1) r = v.size();
  for (int i = l; i < r; i++) cout << v[i] << " ";
  return 0;
}
vector<int> edges[200005];
vector<int> a(200005);
int dp[200005][2];
map<int, bool> visited;
long long n;
void dfs(long long u) {
  visited[u] = true;
  dp[u][0] = 1 - a[u];
  dp[u][1] = a[u];
  for (auto v : edges[u]) {
    if (visited[v]) continue;
    dfs(v);
    int zero = dp[u][0];
    int one = dp[u][1];
    dp[u][0] = mul(zero, dp[v][1]);
    dp[u][1] = mul(one, dp[v][1]);
    dp[u][0] += mul(zero, dp[v][0]);
    dp[u][1] += add(mul(zero, dp[v][1]), mul(one, dp[v][0]));
    dp[u][0] %= MOD;
    dp[u][1] %= MOD;
  }
}
void MAIN(long long current_test_case, long long total_test_cases) {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u = i + 1, v;
    cin >> v;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  dfs(0);
  cout << dp[0][1];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  shouldendl = 1;
  test(get(1));
  return 0;
}
