using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num; if (num == 1) { WriteLine("POSSIBLE");return; }
        var pa = new int[num];
        var chi = Input.edge<int>(num);
        for (var i = 1; i < num; i++)
        {
            pa[i]=Input.Next<int>() - 1;
            chi[pa[i]].Add(i);
        }
        var xs = Input.ar;
        var list = TopologicalSort(pa);
        var dp = Enumerable.Repeat(int.MaxValue/2, num).ToArray();
        foreach (var v in list)
        {
            var kdp = Enumerable.Repeat(int.MaxValue/2, xs[v]+1).ToArray();kdp[0] = 0;
            foreach (var ad in chi[v])
            {
                var newkdp = Enumerable.Repeat(int.MaxValue/2, xs[v]+1).ToArray();
                for (var j = 0; j <= xs[v]; j++)
                {
                    if (j - xs[ad] >= 0) newkdp[j] = Min(newkdp[j],kdp[j - xs[ad]] + dp[ad]);
                    if (j - dp[ad] >= 0) newkdp[j] = Min(newkdp[j],kdp[j - dp[ad]] + xs[ad]);
                }

                kdp = newkdp;
            }
            for (var i = 0; i <= xs[v]; i++)
                dp[v] = Min(dp[v], kdp[i]);
        }
        WriteLine(dp[0] != int.MaxValue/2 ? "POSSIBLE" : "IMPOSSIBLE") ;
    }
    public static List<int> TopologicalSort(IList<int> adj)
    {
        var res = new List<int>(adj.Count);
        var th = new bool[adj.Count];
        for (var i = 0; i < adj.Count; i++)
            if (!th[i])
                Topodfs(adj, i, th, res);
        res.Reverse();
        return res;
    }
    private static void Topodfs(IList<int> adj, int index, bool[] th, List<int> res)
    {
        th[index] = true;
        if (!th[adj[index]])
            Topodfs(adj, adj[index], th, res);
        res.Add(index);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static T[] create<T>(int n, Func<int, T> f)
        => Enumerable.Repeat(0, n).Select(f).ToArray();
    public static char[][] gred(int h)
        => create(h, _ => read.ToCharArray());
    public static int[] ar1D(int n)
        => create(n, _ => num);
    public static long[] arL1D(int n)
        => create(n, _ => numL);
    public static string[] strs(int n)
        => create(n, _ => read);
    public static int[][] ar2D(int n)
        => create(n, _ => ar);
    public static long[][] arL2D(int n)
        => create(n, _ => arL);
    public static List<T>[] edge<T>(int n)
        => create(n, _ => new List<T>());
    public static T GetValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        if (t == typeof(int[]))
            return (T)(object)ar;
        if (t == typeof(long[]))
            return (T)(object)arL;
        return default(T);
    }
    public static void Make<T1, T2>(out T1 v1, out T2 v2)
    {
        v1 = Next<T1>();
        v2 = Next<T2>();
    }
    public static void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        Make(out v1, out v2);
        v3 = Next<T3>();
    }
    public static void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4)
    {
        Make(out v1, out v2, out v3);
        v4 = Next<T4>();
    }
    public static void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)
    {
        Make(out v1, out v2, out v3, out v4);
        v5 = Next<T5>();
    }
    public static void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)
    {
        Make(out v1, out v2, out v3, out v4, out v5);
        v6 = Next<T6>();
    }
    private static Queue<string> sc;
    public static T Next<T>(){ sc = sc ?? new Queue<string>(); if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue<T>(sc.Dequeue()); }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


Measured memory_bytes: 38116