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: f(i,j,k)=lAi+mAj+nAk:1ijkN


Input

First line contains 4 integers N,l,m and n

Second line contains N space separated integers A1,A2,...,An


Output

A single integer denoting the maximum value of the function


Constraints

1N105

109l,m,n109

109Ai1091iN

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 i,j,k as 5 we can get the max value 15+25+35=30

Editor Image

?