Interview
Time limit1sMemory limit1024 MB
Given an array, pick two different elements, replace both with their product, and find the maximum array sum possible with at most one such operation.
Problem
You are given an array of size . You may apply the following operation at most once.
- Choose two elements and from the array. ()
- Replace both chosen elements with .
Find the maximum possible sum of the array after applying the operation at most once.
Input
The first line contains the size of the array . ()
The second line contains integers , separated by spaces. ()
Output
Print the maximum possible sum of the array.