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
/*See this : https://abitofcs.blogspot.com/2014/12/dynamic-programming-on-tree-forming-up.html


*/
import java.util.*;
import java.io.*;
public class lp1{ 
static PrintWriter out = new PrintWriter(System.out);
static int MOD = 1000000007;
static LinkedList<Integer> l[];
static long dp[][];
static int[] col;
static void dfs(int u,int p){
    dp[u][0] = 1 - col[u];
    dp[u][1] = col[u];
    long zero, one;
    for(Integer v : l[u]){

        if(v==p) continue;
        dfs(v,u);
        zero = dp[u][0];
        one = dp[u][1];
        dp[u][0] = 0;
        dp[u][1] = 0;
        
        dp[u][0] = zero * dp[v][1];
        dp[u][0] %= MOD;
        dp[u][1] = one * dp[v][1];
        dp[u][1] %= MOD;
        
        dp[u][0] += zero * dp[v][0];
        dp[u][0] %= MOD;
        dp[u][1] += one * dp[v][0] + zero * dp[v][1];
        dp[u][1] %= MOD;
        
    }
}
public static void main(String[] args){

int n = ni();
l = new LinkedList[n];
dp = new long[n][2];
col = new int[n];
for(int i=0;i<n;i++)
    l[i] = new LinkedList();
for(int i=0;i<(n-1);i++)
{
    int p = ni();
    l[i+1].add(p);
    l[p].add(i+1);
}

for(int i=0;i<n;i++)
  col[i] = ni();
  dfs(0,-1);
  pn(dp[0][1]);

	
   out.flush();
} 
static int BIT[];
static void add(int index,int val)
{
       while(index<BIT.length)
           {
                BIT[index] = BIT[index]+val;
                index = index + (index&(-index));
           }
}
static int get_sum(int index)
{
       int sum=0;
       while(index>0)
         {
              sum = sum+BIT[index];
              index = index- (index&(-index));
         }
      return sum;
}
static void dfs(LinkedList<Integer> l[],int s,int p)
{
         for(Integer I : l[s])
             if(I!=p)
              dfs(l,I,s);
}
static int[] ai(int n)  // it will give in array of size n
{
    int a[] = new int[n];
    for(int i=0;i<n;i++)
        a[i] = ni();
    return a;
}
static long[] al(int n)  // it will give in array of size n
{
    long a[] = new long[n];
    for(int i=0;i<n;i++)
        a[i] = nl();
    return a;
}

static void p(Object o)
{
   out.print(o);
}
static void pn(Object o)
{
    out.println(o);
}
static int abs(int x)
{
    return x>0 ? x : -x;
}
static long gcd(long a,long b)
{
       if(b%a==0)
          return a;
          return gcd(b%a,a);
}
static void subtract_1(char s[]) // it will subtract 1 from the given number.  number should be positive
{
      if(s[0]=='0') // number is zero
          return;
     int n = s.length,i=n-1;
     while(s[i]=='0')
       i--;
     s[i] = (char)((int)(s[i]-'0') + 47);
   
     for(int j=i+1;j<n;j++)
         s[j]='9';
}
static long pow(long a,long b,long md)
{ 
    long ans=1;
    while(b>0)
    {
         if(b%2==1)
           ans = (ans*a)%md;
           a = (a*a)%md;
           b = b/2;
    }
   return ans;
}
static long min(long a,long b){
 
     return a<b ? a : b;
}
static long max(long a,long b){
     return a>b ? a : b;
}
static boolean pal(String s)
{
   int n = s.length(),i1=0,i2=n-1;
 
     while(i1<i2)
     {
        if(s.charAt(i1)!=s.charAt(i2))
             return false;
             i1++; i2--;
     }
       return true;
}
static String rev(String r)
{
    String s = "";
    int i= r.length()-1;
 
    while(i>=0)
    {
        s=s+r.charAt(i);
        i--;   
    }
       return s;
}
static FastReader sc=new FastReader(); 
 
      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
}