n,m,k=gets.split(" ").map{|e| e.to_i}
data=[]
dp=[10**31]*(n+2)
n.times{
data<<gets.to_i
}
dp[0]=0
n.times{|i|
j=i
min1=data[i]
max1=data[i]
while j<n && j<i+m
min1=[min1,data[j]].min
max1=[max1,data[j]].max
t=(j-i+1)*(max1-min1)+k+dp[i]
dp[j+1]=[dp[j+1],t].min
j+=1
end
}
puts dp[n]
bixtLGs9Z2V0cy5zcGxpdCgiICIpLm1hcHt8ZXwgZS50b19pfQpkYXRhPVtdCmRwPVsxMCoqMzFdKihuKzIpCm4udGltZXN7CglkYXRhPDxnZXRzLnRvX2kKfQpkcFswXT0wCm4udGltZXN7fGl8CglqPWkKCW1pbjE9ZGF0YVtpXQoJbWF4MT1kYXRhW2ldCgl3aGlsZSBqPG4gJiYgajxpK20KCQltaW4xPVttaW4xLGRhdGFbal1dLm1pbgoJCW1heDE9W21heDEsZGF0YVtqXV0ubWF4CgkJdD0oai1pKzEpKihtYXgxLW1pbjEpK2srZHBbaV0KCQlkcFtqKzFdPVtkcFtqKzFdLHRdLm1pbgoJCWorPTEKCWVuZAp9CnB1dHMgZHBbbl0=