import sys from collections import deque sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) class ConvexHullTrick: """ 「1次関数の追加」「あるxにおける1次関数群の最小値の取得」を高速に計算できる。 傾きa_iは単調、xは昇順と仮定している。 """ def __init__(self): self.lines = deque() # y = a_1 * x + b1 がminを考えるとき無駄であるか否か(a_0 > a_1 > a_2) def check(self, a0, b0, a1, b1, a2, b2): return (b2 - b1) * (a0 - a1) <= (b1 - b0) * (a1 - a2) # y = a * x + b を追加(a_iが降順のとき) def add(self, a, b): while len(self.lines) >= 2: a0, b0 = self.lines[-2] a1, b1 = self.lines[-1] if self.check(a0, b0, a1, b1, a, b): self.lines.pop() else: break self.lines.append((a, b)) # y = a * x + b を追加(a_iが昇順のとき) def add2(self, a, b): while len(self.lines) >= 2: a1, b1 = self.lines[0] a2, b2 = self.lines[1] if self.check(a, b, a1, b1, a2, b2): self.lines.popleft() else: break self.lines.appendleft((a, b)) # x における1次関数群の最小値を求める def get_min(self, x): a, b = self.lines[0] res = a * x + b while len(self.lines) >= 2: a1, b1 = self.lines[1] y1 = a1 * x + b1 if y1 < res: res = y1 self.lines.popleft() else: break return res N, A, B, W = MI() D = [0] + LI() + [0] inf = 10 ** 18 dp = [inf] * (N + 2) dp[0] = 0 CHT = ConvexHullTrick() for i in range(1, N + 2): CHT.add(-B * (i - 1), dp[i - 1] + i * (i - 1) // 2 * B + A * (i - 1)) dp[i] = D[i] - A * (i - 1) + i * (i - 1) // 2 * B + CHT.get_min(i) ans = W + dp[-1] print(ans)