#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
long long extended(long long a, long long b, long long &x, long long &y) {
  a = abs(a);
  b = abs(b);
  long long g, x1, y1;
  if (!b) {
    x = 1;
    y = 0;
    g = a;
    return g;
  }
  g = extended(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
long long modinverse(long long a, long long M) { return bigmod(a, M - 2, M); }
long long bpow(long long p, long long e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
string convertInt(long long number) {
  if (number == 0) return "0";
  string temp = "";
  string returnvalue = "";
  while (number > 0) {
    temp += number % 10 + 48;
    number /= 10;
  }
  for (int i = 0; i < temp.length(); i++)
    returnvalue += temp[temp.length() - i - 1];
  return returnvalue;
}
long long ncr[1001][1001];
void NCR() {
  for (int i = 1; i <= 1000; i++) {
    ncr[i][i] = 1;
    ncr[i][0] = 1;
    for (int r = 1; r < i; r++) {
      ncr[i][r] = (ncr[i - 1][r] + ncr[i - 1][r - 1]) % 1000000007;
    }
  }
}
vector<int> vec[100009];
long long n;
long long dp[100005][2], ar[100009];
void dfs(int V, int pv) {
  dp[V][0] = 1 - ar[V];
  dp[V][1] = ar[V];
  for (int i = 0; i < vec[V].size(); i++) {
    long long old[2];
    memset(old, 0, sizeof(old));
    int v = vec[V][i];
    if (v == pv) continue;
    old[0] = dp[V][0];
    old[1] = dp[V][1];
    dp[V][0] = dp[V][1] = 0;
    dfs(v, V);
    dp[V][0] += (old[0] * dp[v][1]) % 1000000007;
    dp[V][1] += (old[1] * dp[v][1]) % 1000000007;
    dp[V][1] += (old[1] * dp[v][0]) % 1000000007;
    dp[V][1] += (old[0] * dp[v][1]) % 1000000007;
    dp[V][0] += (old[0] * dp[v][0]) % 1000000007;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int v;
    cin >> v;
    vec[i].push_back(v);
    vec[v].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    int val;
    cin >> val;
    ar[i] = val;
  }
  dfs(0, -1);
  cout << dp[0][1] % 1000000007 << endl;
}
