```
class Solution(object):
def depthSum(self, nestedList, depth=1):
"""
:type nestedList: List[NestedInteger]
:rtype: int
"""
if nestedList is None:
return 0
if isinstance(nestedList, list):
total = 0
for lst in nestedList:
total += self.depthSum(lst, depth)
return total
elif isinstance(nestedList, NestedInteger) and nestedList.isInteger():
return depth*nestedList.getInteger()
else:
total = 0
for lst in nestedList.getList():
total += self.depthSum(lst, depth+1)
return total
```