import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 from collections import deque # 最小値、傾き単調減少、x単調増加 class ConvexHullTrick: def __init__(self): self.ab = deque() def add_line(self, a, b): if self.ab and a == self.ab[-1][0]: if b >= self.ab[-1][1]: return self.ab.pop() while len(self.ab) > 1: c, d = self.ab[-1] e, f = self.ab[-2] if (b-d)*(e-c) > (d-f)*(c-a): break self.ab.pop() self.ab.append((a, b)) def min(self, x): if not self.ab: return (1 << 63)-1 while len(self.ab) > 1: a, b = self.ab[0] c, d = self.ab[1] if a*x+b < c*x+d: break self.ab.popleft() a, b = self.ab[0] return a*x+b n, a, b, w = LI() dd = LI() cht = ConvexHullTrick() cht.add_line(0, 2*w) ans = w+n*(n+1)//2*b-a*n for i, d in enumerate(dd): cur = (cht.min(i)+i*(b*(i+1)-2*a)+2*d)//2 r = n-i-1 ans = min(ans, cur+r*(r+1)//2*b-a*r) i += 1 cht.add_line(-2*b*i, 2*cur+i*(b*(i-1)+2*a)) print(ans)