func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int power(long long int a, long long int b) {     a %= 1000000007;     long long int res = 1;     while (b > 0) {       if (b & 1) res = res * a % 1000000007;       a = a * a % 1000000007;       b >>= 1;     }     return res;   }   long long int modinv(long long int p) { return power(p, 1000000007 - 2); }   vector<long long int> arr[200000];   long long int dp[100005][2] = {0};   void dfs(long long int s, long long int p, long long int a[]) {     if (a[s] == 0) {       long long int su = 1;       dp[s][1] = 0;       for (auto it : arr[s]) {         if (it != p) {           dfs(it, s, a);           su *= (dp[it][0] + dp[it][1]);           su %= 1000000007;         }       }       dp[s][0] = su % 1000000007;       for (auto it : arr[s]) {         if (it != p) {           if (dp[it][0] + dp[it][1] > 0) {             dp[s][1] += (dp[it][1] *                          ((su * modinv(dp[it][0] + dp[it][1])) % 1000000007)) %                         1000000007;             dp[s][1] %= 1000000007;           }         }       }     } else {       dp[s][0] = 0;       dp[s][1] = 1;       for (auto it : arr[s]) {         if (it != p) {           dfs(it, s, a);           dp[s][1] *= (dp[it][0] + dp[it][1]) % 1000000007;           dp[s][1] %= 1000000007;         }       }     }   }   int main() {     long long int n;     cin >> n;     long long int q;     for (long long int x = 1; x < n; x++) {       cin >> q;       arr[q].push_back(x);       arr[x].push_back(q);     }     long long int a[n];     for (int x = 0; x < n; x++) {       cin >> a[x];     }     dfs(0, -1, a);     cout << dp[0][1] % 1000000007 <<   n ;   }   