#include <cstdio>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
#define repd(i,x,y) for (int i=x; i>=y; --i)
using namespace std;

int n,fa[1010],a[1010],f[1010],g[1010][5010];

void insert(int *f,int n,int x,int y)
{
    repd(i,n,0)
    {
        int t=1<<29;
        if (i>=x)
            t=min(t,f[i-x]+y);
        if (i>=y)
            t=min(t,f[i-y]+x);
        f[i]=t;
    }
}

int main()
{
    scanf("%d",&n);
    repu(i,2,n)
        scanf("%d",&fa[i]);
    repu(i,1,n)
        scanf("%d",&a[i]);
    repd(i,n,1)
    {
        f[i]=1<<29;
        repu(j,0,a[i])
            f[i]=min(f[i],g[i][j]);
        insert(g[fa[i]],a[fa[i]],a[i],f[i]);
    }
    puts(f[1]<1<<29?"POSSIBLE":"IMPOSSIBLE");
    return 0;
}