Nested list weight sum and Basic calculator
You are given a nested structure of integers, where elements can be either single integers or lists containing more integers or lists. Your task is to calculate the total sum of all integers multiplied by their depth level in the nesting.
The depth level starts at 1 for the outermost list and increases by 1 for each level of nesting inside.
Example 1:
Input: [[2, 2], 3, [2, 2]] Output: 15 Explanation: Four 2's at depth 2 (2*2*4=16), one 3 at depth 1 (3*1=3), total is 16 + 3 = 19.
Example 2:
Input: [3, [5, [7]]] Output: 38 Explanation: One 3 at depth 1 (3*1=3), one 5 at depth 2 (5*2=10), one 7 at depth 3 (7*3=21); sum is 3 + 10 + 21 = 34.