<p>Given two arrays of integers with equal lengths, return the maximum value of:</p>

<p><code>|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|</code></p>

<p>where the maximum is taken over all <code>0 &lt;= i, j &lt; arr1.length</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,2,3,4], arr2 = [-1,4,5,6]
<strong>Output:</strong> 13
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> arr1 = [1,-2,-5,0,10], arr2 = [0,-2,-1,-7,-4]
<strong>Output:</strong> 20
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>2 &lt;= arr1.length == arr2.length &lt;= 40000</code></li>
	<li><code>-10^6 &lt;= arr1[i], arr2[i] &lt;= 10^6</code></li>
</ul>

class Solution:
    def maxAbsValExpr(self, arr1: List[int], arr2: List[int]) -> int:
        n = len(arr1)
        max_val = float('-inf')
        min_val = float('inf')
        
        # Calculate max and min values for each simplified expression
        for p, q, r in [(1, 1, 1), (1, 1, -1), (1, -1, 1), (1, -1, -1)]:
            max_arr = float('-inf')
            min_arr = float('inf')
            for i in range(n):
                val = p * arr1[i] + q * arr2[i] + r * i
                max_arr = max(max_arr, val)
                min_arr = min(min_arr, val)
            max_val = max(max_val, max_arr - min_arr)
        
        return max_val

# Example usage:
solution = Solution()
arr1 = [1, 2, 3, 4]
arr2 = [-1, 4, 5, 6]
print(solution.maxAbsValExpr(arr1, arr2))  # Output: 13

arr1 = [1, -2, -5, 0, 10]
arr2 = [0, -2, -1, -7, -4]
print(solution.maxAbsValExpr(arr1, arr2))  # Output: 20
23500