import numpy as np

n,d=map(int,input().split())
a=np.array(list(map(int,input().split())))

c=a[0]
link=[i*d+c+a[i] for i in range(1,n)]

for i in range(1,n):
    e=a[i]
    for j in range(i+1,n):
        f=(j-i)*d+e+a[j]
        if link[i] > f:
            link[i] = f

print(sum(link))