Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays. A subarray is a contiguous subsequence of the array. Return the sum of all odd-length subarrays of arr.
Input Format
Input and output are managed for you. Just complete the function.
Output Format
Input and output are managed for you. Just complete the function.
Constraints
1 <= arr.length <= 100 1 <= arr[i] <= 1000
Notice
NA
Example
Input
5 1 4 2 5 3
Output
58