def calculateMagnitude(num):
    left = num[0]
    right = num[1]
    if (type(left) == list):
        left = calculateMagnitude(left)
    if (type(right) == list):
        right = calculateMagnitude(right)
    return ((3 * left) + (2 * right))
def calculateMagnitude(num):
    left = num[0]
    right = num[1]
    if (type(left) == list):
        left = calculateMagnitude(left)
    if (type(right) == list):
        right = calculateMagnitude(right)
    return ((3 * left) + (2 * right))