':type nestedList: List[NestedInteger]
:rtype: int'

def depthSumInverse(self, nestedList):

    def depthSumInverseHelper(list, depth, result):
        if (len(result) < (depth + 1)):
            result.append(0)
        if list.isInteger():
            result[depth] += list.getInteger()
        else:
            for l in list.getList():
                depthSumInverseHelper(l, (depth + 1), result)
    result = []
    for list in nestedList:
        depthSumInverseHelper(list, 0, result)
    sum = 0
    for i in reversed(xrange(len(result))):
        sum += (result[i] * (len(result) - i))
    return sum
