count :: [Int] -> [Int] -> [Int] -> Int -> Int
count [] b c prev = 0
count (a0:a1) b c prev
    | a0 == prev + 1  = b !! a0 + c !! prev + count a1 b c a0
    | otherwise         = b !! a0 + count a1 b c a0  



main = do
    getLine 
    a <- map read . words <$> getLine
    b <- map read . words <$> getLine
    c <- map read . words <$> getLine
    let a' = map (+(-1)) a
        c' = map (+(-1)) c
    print (count a' b c 100)
