func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000 * 100 + 10;   vector<int> vec[MAXN];   int c[MAXN];   long long dp[2][MAXN];   void dfs(int v) {     vector<int> temp;     long long all = 1;     for (int i = 0; i < (int)vec[v].size(); i++) {       int u = vec[v][i];       dfs(u);       temp.push_back(all);       all = (all * (dp[0][u] + dp[1][u])) % (1000 * 1000 * 1000 + 7);     }     if (c[v]) {       dp[1][v] = all;       dp[0][v] = 0;     } else {       dp[0][v] = all;       all = 1;       for (int i = (int)vec[v].size() - 1; i >= 0; i--) {         int u = vec[v][i];         dp[1][v] = (dp[1][v] +                     (((temp[i] * all) % (1000 * 1000 * 1000 + 7)) * dp[1][u]) %                         (1000 * 1000 * 1000 + 7)) %                    (1000 * 1000 * 1000 + 7);         all = (all * (dp[0][u] + dp[1][u])) % (1000 * 1000 * 1000 + 7);       }     }   }   int main() {     int n;     cin >> n;     for (int i = 1; i < n; i++) {       int a;       cin >> a;       vec[a].push_back(i);     }     for (int i = 0; i < n; i++) cin >> c[i];     dfs(0);     cout << dp[1][0] << endl;     return 0;   }   