Java Solution
Code
# Code
```java []
class Solution {
    public int minimumSum(int[] nums) {
        int sum =Integer.MAX_VALUE;
        int n = nums.length;

        for(int j = 1;j<n;j++){
            int left = Integer.MAX_VALUE;
            int right = Integer.MAX_VALUE;

            int i = j-1;
            while(i >= 0){
                if(nums[i] < nums[j]){
                    left = Math.min(left, nums[i]);
                }
                i--;
            }

            int k = j+1;
            while(k < n){
                if(nums[k] < nums[j]){
                    right = Math.min(right, nums[k]);
                }
                k++;
            }

            if(left != Integer.MAX_VALUE && right != Integer.MAX_VALUE){
                sum = Math.min(sum, left + right+nums[j]);
            }
        }

        return sum == Integer.MAX_VALUE ? -1 : sum;
    }
}
```
['Java']