#include <cstdio>
#include <vector>
#include <bitset>

int n,Li[1005],Mv[5005],Sum;
std::vector<int> g[1005];
std::bitset<5005> v;

int main()
{
    scanf("%d",&n);
    for(int i=2,u;i<=n;++i)scanf("%d",&u),g[u].push_back(i);
    for(int i=1;i<=n;++i)scanf("%d",&Li[i]);
    for(int i,x=n;x>=1;--x)
    {
        v=1,Sum=0;
        for(int y:g[x])v=(v<<Li[y])|(v<<Mv[y]),Sum+=Li[y]+Mv[y];
        for(i=Li[x];i>=0&&!v[i];--i);
        if(i==-1)return puts("IMPOSSIBLE"),0;
        Mv[x]=Sum-i;
    }
    return puts("POSSIBLE"),0;
}