def get_sum(path, tree):
    """ Returns the sum of all the numbers in the path for the given tree. """
    pathsum = 0
    for i, row in enumerate(tree):
        pathsum += row[path[i]]
    return pathsum