#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MAXE = 200005;
const int mod = 1e9 + 7;
struct Edge {
  int v;
  Edge* next;
} E[MAXE], *H[MAXN], *cur;
int color[MAXN];
long long dp[MAXN][2];
void clear() {
  cur = E;
  memset(H, 0, sizeof H);
  memset(color, 0, sizeof color);
  memset(dp, 0, sizeof dp);
}
void addedge(int u, int v) {
  cur->v = v;
  cur->next = H[u];
  H[u] = cur++;
}
void scanf(int& x, char c = 0) {
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
}
void dfs(int u, int f = 0) {
  dp[u][color[u]] = 1;
  for (Edge* e = H[u]; e; e = e->next) {
    int v = e->v;
    if (v == f) continue;
    dfs(v, u);
    dp[u][1] =
        (dp[u][1] * (dp[v][0] + dp[v][1]) % mod + dp[u][0] * dp[v][1]) % mod;
    dp[u][0] = dp[u][0] * (dp[v][0] + dp[v][1]) % mod;
  }
}
void solve() {
  int n, x;
  while (~scanf("%d", &n)) {
    clear();
    for (int i = (1); i < (n); ++i) {
      scanf(x);
      addedge(x, i);
      addedge(i, x);
    }
    for (int i = (0); i < (n); ++i) scanf(color[i]);
    dfs(0);
    printf("%I64d\n", dp[0][1]);
  }
}
int main() {
  solve();
  return 0;
}
