SP33331 ADAGRAFT - Ada and Graft

Description

As you might already know, Ada the Ladybug is a farmer. She grows a big fruit [tree](https://en.wikipedia.org/wiki/Tree_(data_structure)) (with root in 0). There is a fruit on every node of the tree. Ada is competing in grafting competition and this is her masterpiece. The most valuable tree wins the competition. The value of tree is product of values of each node. The value of a node is the number of distinct fruit kinds in its subtree. Can you find the value of Ada's tree? Since this number might be pretty big, output it modulo **10 $ ^{9} $ +7**

Input Format

The first and line will contain **1 .** The next line will contain **N-1** integers **0 , the parent of i $ ^{th} $ node.** The next line will contain **N** integers **0 , the fruit growing on i $ ^{th} $ node.**

Output Format

Print a single integer - the value of tree modulo **1000000007**.