Maximising problem

0

0 votes
Easy
Problem

You are given an array of integers A of size N and 3 integers l, m, n. Your task is to find the maximum value of the given function:


Input

First line contains 4 integers and n

Second line contains N space separated integers


Output

A single integer denoting the maximum value of the function


Constraints

Sample Input
5 1 2 3
1 2 3 4 5
Sample Output
30
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

On choosing values of as 5 we can get the max value

Editor Image

?