level 11
const c=100;
var a:array[0..c] of longint;
n,x,y,z,s:longint;
procedure ReadData;
var i:integer;
begin
readln(n);
readln(x,y,z);
for i:=1 to n do
read(a[i]);
end;
procedure Main;
var i,r,s1,s2:longint;
begin
r:=a[1];
s:=r*(x+y);
for i:=2 to n do
begin
if a[i]>r then begin inc(s,(a[i]-r)*x); r:=a[i]; end;
if a[i]<r then
begin
s1:=r*y;
s2:=a[i]*y+(r-a[i])*z;
if s1>s2 then begin inc(s,(r-a[i])*z); r:=a[i]; end;
if s1=s2 then
if a[i+1]<a[i] then begin inc(s,(r-a[i])*z); r:=a[i]; end;
end;
inc(s,r*y);
end;
end;
BEGIN
assign(input,'hire.in');
assign(output,'hire.out');
reset(input);
rewrite(output);
ReadData;
Main;
writeln(s);
close(input);
close(output);
END.
2014年03月22日 02点03分