Problem:
 Score : 500 points    Problem Statement There are N towns on a line running east-west.
The towns are numbered 1 through N , in order from west to east.
Each point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.
The coordinate of town i is X_i .  You are now at town 1 , and you want to visit all the other towns.
You have two ways to travel:    Walk on the line.
Your fatigue level increases by A each time you travel a distance of 1 , regardless of direction.    Teleport to any location of your choice.
Your fatigue level increases by B , regardless of the distance covered.    Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.      Constraints  All input values are integers.  2≤N≤10^5  1≤X_i≤10^9  For all i(1≤i≤N-1) , X_i<X_{i+1} .  1≤A≤10^9  1≤B≤10^9         Input The input is given from Standard Input in the following format:  N  A  B  X_1  X_2  ...  X_N       Output Print the minimum possible total increase of your fatigue level when you visit all the towns.        Sample Input 1 4 2 5
1 2 5 7      Sample Output 1 11  From town 1 , walk a distance of 1 to town 2 , then teleport to town 3 , then walk a distance of 2 to town 4 .
The total increase of your fatigue level in this case is 2×1+5+2×2=11 , which is the minimum possible value.       Sample Input 2 7 1 100
40 43 45 105 108 115 124      Sample Output 2 84  From town 1 , walk all the way to town 7 .
The total increase of your fatigue level in this case is 84 , which is the minimum possible value.       Sample Input 3 7 1 2
24 35 40 68 72 99 103      Sample Output 3 12  Visit all the towns in any order by teleporting six times.
The total increase of your fatigue level in this case is 12 , which is the minimum possible value.

Solution (Python):
N,A,B = map(int,input().split())
X = [int(x) for x in input().split()]

dist = [a-b for a,b in zip(X[1:],X[:-1])]
ans = [min(x*A,B) for x in dist]

print(sum(ans))

Solution (Python):
n, a, b = map(int, input().split())
X = list(map(int, input().split()))
time = 0
for i in range(n-1):
  c = (X[i+1] - X[i]) * a 
  if c > b:
    time += b
  else:
    time += c
print(time)

Solution (Python):
N, A, B = map(int, input().split())

X = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    dis = X[i+1] - X[i]
    if dis * A > B:
        ans += B
    else:
        ans += dis * A
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
X=[int(x) for x in input().split()]
hirou=0

for i in range(n-1):
    if (X[i+1]-X[i])*a>=b:
        hirou+=b
    else:
        hirou+=(X[i+1]-X[i])*a

print(hirou)

Solution (Python):
N,A,B=map(int,input().split())
X=list(map(int,input().split()))

ans=0
for i in range(N-1):
  ans+=min((X[i+1]-X[i])*A,B)

print(ans)

Solution (Python):
n, a, b = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
  if (l[i+1]-l[i])*a <= b:
    ans += (l[i+1]-l[i])*a
  else:
    ans += b
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N,A,B = map(int,input().split())
    X = list(map(int,input().split()))
    walk = B//A
    fatigue = 0
    for i in range(N-1):
        dif = X[i+1]-X[i]
        if dif <= walk:
            fatigue += dif*A
        else:
            fatigue += B

    print(fatigue)

if __name__ == "__main__":
    main()

Solution (Python):
n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
for i in range(1, n):
  ans += min(b, a*(x[i]-x[i-1]))
print(ans)

Solution (Python):
def resolve():
    n, a, b = list(map(int, input().split()))
    x = list(map(int, input().split()))
    e = 0
    for i in range(n - 1):
        e += min(abs(x[i + 1] - x[i]) * a, b)
    print(e)


if __name__ == "__main__":
    resolve()

Solution (Python):
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
cost = 0
for i in range(N-1):
    dist = X[i+1] - X[i]
    if dist * A < B:
        cost += (dist * A)
    else:
        cost += B
print(cost)

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for i in range(len(x) - 1):
    ans += min((x[i + 1] - x[i]) * a, b)

print(ans)

Solution (Python):


n,a,b=map(int,input().split())
x=list(map(int,input().split()))

cnt=0
for i in range(n-1):
    cnt+=min(abs(x[i]-x[i+1])*a,b)
print(cnt)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(1, N):
    D = X[i] - X[i - 1]
    ans += min(D * A, B)

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans1 = 0
ans2 = 0
for i in range(1, N):
    D = X[i] - X[i - 1]
    ans1 += D * A
    ans2 += min(D * A, B)

print(min(ans1, ans2))

Solution (Python):

import os,re,sys,operator,math,heapq,string



from sys import stdin,setrecursionlimit


setrecursionlimit(10**6)
input=stdin.readline

n,a,b=map(int,input().split())
x=[int(i) for i in input().split()]
ans=0
for i in range(1,n):
    now=x[i]-x[i-1]
    ans+=min(now*a,b)
    
print(ans)

Solution (Python):
def main():
    N, A, B, *X = map(int, open(0).read().split())
    print(sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N, A, B, *X = map(int, open(0).read().split())
    print(sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))

main()

Solution (Python):
N, A, B, *X = map(int, open(0).read().split())
print(sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1)))

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0

for i in range(n-1):
	if (x[i+1] - x[i]) * a <= b:
		ans += (x[i+1] - x[i]) * a
	else:
		ans += b

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, A, B = map(int, input().split())
L = [int(v) for v in input().split()]

ans = 0
for i in range(N - 1):
    s = L[i + 1] - L[i]
    ans += min(s * A, B)

print(ans)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)


N, A, B = map(int, input().split())
X = list(map(int, input().split()))

hi = 0

for i in range(N-1):
    diff = X[i+1] - X[i]
    hi += min(diff*A, B)

print(hi)

Solution (Python):

def main():
    
    N, A, B = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    ans = sum(min(A * (j - i), B) for i, j in zip(X, X[1:]))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    
    N, A, B = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    ans = sum(min(A * (j - i), B) for i, j in zip(X, X[1:]))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    
    N, A, B = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    D = [j - i for i, j in zip(X, X[1:])]  
    ans = sum(min(A * d, B) for d in D)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(N - 1) :
    if (X[i + 1] - X[i]) * A < B :
        ans += (X[i + 1] - X[i]) * A
    else :
        ans += B

print(ans)

Solution (Python):


N,A,B = list(map(int, input().split(" ")))
Xs = list(map(int, input().split(" ")))
Xs.sort()
ans = 0
for i in range(1,N ):
    ans += min (B,abs(Xs[i] - Xs[i-1])* A )

print(ans)

Solution (Python):
import copy
import sys
import math

def main():
	n,a,b = map(int,input().split())
	x = list(map(int,input().split()))
	ans = 0
	for i in range(1,n):
		renji = x[i] - x[i-1]
		if(renji * a > b):
			ans += b
		else:
			ans += renji * a
	print(ans)


def listtodict(a):
	b = {}
	for i in a:
		try:
			b[i] += 1
		except:
			b[i] = 1
	return b

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

main()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n = I()

    return


def B():
    n = I()

    return


def C():
    n = I()

    return


def D():
    def root(x):
        if x == par[x]:
            return x
        par[x] = root(par[x])
        return par[x]

    def unite(x,y):
        x = root(x)
        y = root(y)
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    n,a,b = LI()
    par = [i for i in range(n)]
    rank = [0]*n
    x = LI()
    for i in range(n-1):
        if a*(x[i+1]-x[i]) < b:
            unite(i,i+1)
    ans = 0
    f = [1]*n
    f[0] = 0
    for i in range(1,n):
        if f[root(i)]:
            ans += b
            f[root(i)] = 0
        else:
            ans += a*(x[i]-x[i-1])
    print(ans)
    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    D()

Solution (Python):
n,a,b = map(int,input().split())

nums=list(map(int,input().split()))
tmp=nums[0]
ans=0
for num in nums[1:]:
  if (num-tmp)*a<=b: 
    ans+=(num-tmp)*a
  else:
    ans+=b
  tmp=num

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
result = 0
for i in range(N - 1):
    result += min(A * (X[i + 1] - X[i]), B)
print(result)

Solution (Python):
N, A, B = map(int, input().split())
*X, = map(int, input().split())
diff = [X[i] - X[i-1] for i in range(1, N)]
cost = 0
for d in diff:
    cost += min(A*d, B)
print(cost)

Solution (Python):
n,a,b = list(map(int, input().split()))
x = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    costa = (x[i+1]-x[i])*a
    costb = b
    ans += min(costa,costb)

print(ans)

Solution (Python):
n,a,b=map(int,input().split())
x_list=[int(i) for i in input().split()]
result=0
for i in range(1,n):
	result+=min(a*(x_list[i]-x_list[i-1]),b)
print(result)

Solution (Python):
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
c=0
p=x[0]
for i in x[1:]:
    c+=min((i-p)*a,b)
    p=i
print(c)

Solution (Python):
n,a,b=map(int,input().split())
arr=list(map(int,input().split()))
ans=0
for i in range(1,n):
  d=arr[i]-arr[i-1]
  if a*d>b:
    ans+=b
  else:
    ans+=a*d
print(ans)

Solution (Python):

"""
D - Walk and Teleport
https://atcoder.jp/contests/arc067/tasks/arc067_b

"""
import sys


def solve(N, A, B, X):
    gaps = [z-y  for y, z in zip(X, X[1:])]
    ans = 0
    for g in gaps:
        if g*A <= B:
            ans += g*A
        else:
            ans += B
    return ans


def main(args):
    N, A, B = map(int, input().split())
    X = [int(x) for x in input().split()]
    ans = solve(N, A, B, X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):

N,A,B = map(int,input().split())
X = list(map(int,input().split()))
ans = 0
now = 0
for i in range(N):
    if i == 0:
        now = X[0]
    else:
        ans += min((X[i]-now)*A,B)
        now = X[i]
print(ans)

Solution (Python):
N,A,B = list(map(int, input().split()))
X = list(map(int, input().split()))

ans = 0
for i in range(1, N):
  ans += min(B, A*(X[i]-X[i-1]))
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
*x,=map(int,input().split())
print(sum(min(abs(a*(x[i-1]-x[i])),b)for i in range(1,n)))

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    ans += min((X[i + 1] - X[i]) * A, B)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
inf = float('inf')


N,A,B = map(int,input().split())
X = list(map(int,input().split()))

ans = 0

for i in range(N-1):
    d = X[i+1]-X[i]
    ans += min(d*A, B)

print(ans)

Solution (Python):
n,a,b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    ans += min((x[i+1]-x[i])*a, b)

print(ans)

Solution (Python):
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
res = 0
for i in range(1,n):
    res+=min(a*(x[i]-x[i-1]),b)
print(res)

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans=0
for i in range(1, n):
    kyori = x[i]-x[i-1]
    ans+=min(kyori*a,b)
print(ans)

Solution (Python):
n,a,b=map(int,input().split())
X=[int(i) for i in input().split()]
cur=X[0]
ans=0
for i in range(1,n):
  ans+=min(a*(X[i]-cur),b)
  cur=X[i]
print(ans)

Solution (Python):
import math
n,a,b = map(int,input().split())
kyori = []
telepo = math.ceil(b / a)
counter = 0
ans = 0
x = list(map(int,input().split()))
for i in range(1,n):
    tmp = x[i] - x[i-1]
    if tmp >= telepo:
        counter +=1
    else:
        kyori.append(tmp)
for i in kyori:
    ans +=a*i
ans = ans + counter * b
print(ans)

Solution (Python):

N, A, B = map(int, input().split())
X = list(map(int, input().split()))


ans = sum(
    min(A * (r - l), B)
    for l, r in zip(X, X[1:])
)


print(ans)

Solution (Python):
N,A,B = map(int, input().split())
X = [int(i) for i in input().split()]
ans = 0
for i in range(N-1):
    d = X[i+1] - X[i]
    ans += min(A*d, B)
print(ans)

Solution (Python):
N, A, B = map(int, input().split(' '))
X_list = list(map(int, input().split(' ')))

d_max = B // A + 1

cost = 0
x_1 = X_list.pop()
while(X_list):
    x_2 = X_list.pop()
    d = x_1 - x_2
    if d < d_max:
        cost += A * d
    else:
        cost += B
    x_1 = x_2

print(cost)

Solution (Python):
N,A,B = map(int,input().split())
X = list(map(int,input().split()))

ans = 0

for i in range(N-1) :
    ans += min((X[i+1]-X[i])*A, B)

print(ans)

Solution (Python):
n, a, b = map(int, input().split())
ans = 0
v = list(map(int, input().split()))
for i in range(n):
  if i:
    ans += min(a * (v[i] - last), b);
  last = v[i]
print(ans)

Solution (Python):
N, A, B = [int(_) for _ in input().split()]
X = [int(_) for _ in input().split()]
ans = 0
for i in range(N - 1):
    ans += min([A * (X[i + 1] - X[i]), B])
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0

for i in range(1, n):
    if (x[i]-x[i-1])*a <= b:
        ans += (x[i]-x[i-1])*a
    else:
        ans += b
print(ans)

Solution (Python):
from itertools import accumulate
from math import*
from collections import deque
from collections import defaultdict
from itertools import permutations
from heapq import*
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
from functools import reduce

n,a,b = map(int,input().split())
x = list(map(int,input().split()))
edge = []
class UnionFind():
    def __init__(self, N):
        self.rank = [0] * N
        self.par = [i for i in range(N)]
        self.counter = [1] * N

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            z = self.counter[x] + self.counter[y]
            self.counter[x], self.counter[y] = z, z
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def size(self, x):
        x = self.find(x)
        return self.counter[x]

    def same(self, x, y):
        return self.find(x) == self.find(y)
for i in range(1,n):
    c = (x[i]-x[i-1])*a
    edge.append((c,i-1,i))

uf = UnionFind(n)
edge.sort()
ans = 0
edge_cnt = 0
i = 0
while edge_cnt < n-1:
    cost,i1,i2 = edge[i]
    if not uf.same(i1,i2):
        ans += min(b,cost)
        uf.unite(i1,i2)
        edge_cnt += 1
    i += 1
print(ans)

Solution (Python):
n,a,b = map(int,input().split())

x = list(map(int,input().split()))

res = 0

now = x[0]

for nxt in x[1:]:
    dis = nxt - now
    if dis*a>b:
        res+=b
    else:
        res+=dis*a
    now = nxt
print(res)

Solution (Python):



N,A,B=map(int,input().split())
X = [int(x) for x in input().split()]

ans = 0
for a,b in zip(X[:-1],X[1:]):
  ans += min((b-a)*A,B)
  
print(ans)

Solution (Python):
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
l = 0
for i in range(n-1):
    if (x[i+1] - x[i]) *  a <= b:
        l += (x[i+1] -x[i])*a
    else:
        l += b

print(l)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    ans += min((X[i+1] - X[i]) * A, B) 
print(ans)

Solution (Python):
import sys
from collections import Counter
sys.setrecursionlimit(10**7)
mo=10**9+7
n=10**5

n,a,b=map(int,input().split())
x=[int(i) for i in input().split()]
ans=0
pre=x[0]
for i in range(1,n):
    cur=x[i]
    if (cur-pre)*a>b:
        ans+=b
        
    else:
        ans+=(cur-pre)*a
    pre=cur
    
print(ans)

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,a,b = f()
    x = f()
    dp = [0]*n
    for i in range(1,n):
        dp[i] = min(dp[i-1]+a * (x[i] - x[i-1]), dp[i-1]+b)
    
    print(dp[n-1])
    

solve()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
from functools import partial, reduce
from operator import mul
prod = partial(reduce, mul)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N, A, B = LI()
    X = LI()
    ans = 0
    for x, y in zip(X, X[1:]):
        if (y - x) * A < B:
            ans += (y - x) * A
        else:
            ans += B
    return ans

print(main())

Solution (Python):
n,a,b = map(int,input().split())
l = list(map(int,input().split()))
s = 0
for i in range(n-1):
  s += min((l[i+1]-l[i])*a,b)
print(s)

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
uf = [1]*n
ans = 0
for i in range(n-1):
    if a*(x[i+1]-x[i]) <= b:
        ans += a*(x[i+1]-x[i])
        uf[i+1] = 0
ans += b*(sum(uf)-1)
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
xlist = list(map(int, input().split()))

prevx = xlist[0]
c = 0
for x in xlist[1:]:
  if (x - prevx) * a > b:
    c += b
  else:
    c += (x - prevx) * a
  prevx = x
print(c)

Solution (Python):
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n-1):
    ans+=min(a*(x[i+1]-x[i]),b)
print(ans)

Solution (Python):
while True:
    try:
        n,a,b=map(int,input().split())
    except:
        break
    thelist=list(map(int,input().split()))
    t=b//a
    sum=0
    for i in range(1,n):
        tt=thelist[i]-thelist[i-1]
        if tt>t:
            sum+=b
        else:
            sum+=a*tt
    print(sum)

Solution (Python):
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ret=0
for i in range(n-1):
  ret+=min(a*(x[i+1]-x[i]),b)
print(ret)

Solution (Python):
N, A, B = map(int, input().split())
ans = 0
x = list(map(int, input().split()))
for i in range(len(x)-1):
  ans += min(B, (x[i+1]-x[i]) * A)
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N, A, B = map(int, input().split())

ans = 0
L = list(map(int, input().split()))

diff = [0]*N
for i in range(N):
    diff[i] = L[i]-L[i-1]

for i in range(1, N):
    if diff[i]*A >= B:
        ans += B
    else:
        ans += diff[i]*A
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
num = 0
pre = X[0]
for i in range(1, N):
    num += min((X[i] - pre) * A, B)
    pre = X[i]

print(num)

Solution (Python):
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n-1):
    ans+=min((x[i+1]-x[i])*a,b)
print(ans)

Solution (Python):
N,A,B=map(int,input().split())
x=map(int,input().split())
ls=[]
a=0
for i in x:
     ls.append(i)
for i in range(len(ls)-1):
     result=ls[i+1]-ls[i]
     if result*A>B:
          a+=B
     else:
          a+=result*A
print(a)

Solution (Python):
N,A,B=map(int,input().split())
X=[int(i) for i in input().split()]
ans=0
for i in range(N-1):
    dist=X[i+1]-X[i]
    ans+=min(dist*A,B)
print(ans)

Solution (Python):


def main():
    n, a, b = map(int, input().split())
    xn = list(map(int, input().split()))

    res = 0
    for i in range(1, n):
        res += min(b, (xn[i] - xn[i - 1]) * a)
    print(res)

main()

Solution (Python):
def ARC067():
    N, A, B = map(int, input().split())
    X = list(map(int, input().split()))
    if A >= B:
        A = B
    ans = 0
    for i in range(1, N):
        if (X[i] - X[i - 1]) * A > B:
            ans += B
        else:
            ans += A * (X[i] - X[i - 1])
    print(ans)
ARC067()

Solution (Python):
a,b,c = map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
count = 0
for i in range(a-1):
    if (ar[i+1] - ar[i]) * b <= c:
        count += (ar[i+1] - ar[i]) * b
    else:
        count += c
print(count)

Solution (Python):
N, A, B = map(int,input().split())
X = [int(i) for i in input().split()]
X.insert(0,0)

ans = 0
for i in range(2, N+1):
    ans += min(A *(X[i] -X[i-1]), B)

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
T=[int(i) for i in input().split()]
ans=0
for i in range(N-1):
  if B>=A*(T[i+1]-T[i]):
    ans+=A*(T[i+1]-T[i])
  else:
    ans+=B
    
print(ans)

Solution (Python):

"""
N=int(input())

print(800*N-int(N/15)*200)
"""
"""
N=int(input())
S=input()

max_n=0
temp=0
for strng in S:
	if strng=="I":
		temp+=1
		if max_n<temp:
			max_n=temp
	else:
		temp-=1
print(max_n)
"""
"""
N=int(input())

Q=1000000007
p=1
for i in range(1,N+1):
	p*=i
	p=p%Q
print(p%Q)
"""

"""
n=int(input())
S=[input() for i in range(n)]
alphabet_dict={chr(97+i):100 for i in range(26)}
for s in S:
	temp={chr(97+i):0 for i in range(26)}
	for i in s:
		temp[i]+=1

	for key in alphabet_dict.keys():
		if alphabet_dict[key]>temp[key]:
			alphabet_dict[key]=temp[key]
result=""
for item in alphabet_dict.items():
	for i in range(item[1]):
		result+=item[0]
if result=="":
	print("\n")
else:
	print(result)
"""
"""
(N,M) = [int(i)for i in input().split()]

if N>int(M/2):
	print(int(M/2))
else:
	hoge=int(M/2)-N
	print(N+int(hoge/2))
"""
(N,A,B) = [int(i)for i in input().split()]
X=[int(i) for i in input().split()]

hirou=0
for i in range(N-1):
	length=X[i+1]-X[i]
	if length*A <= B:
		hirou+=length*A
	else:
		hirou+=B
print(hirou)

Solution (Python):

n,a,b = map(int, input().split())
x = [int(i) for i in input().split()]

ret = 0
for i in range(n-1):
    if (x[i+1]-x[i])*a>=b:
        ret += b
    else:
        ret += (x[i+1]-x[i])*a
print(ret)

Solution (Python):
N, A, B = list(map(int, input().split()))
s = 0
X = list(map(int, input().split()))

for i in range(1, N):
	s += min((X[i] - X[i - 1]) * A, B)

print(s)

Solution (Python):
def inpl(): return [int(i) for i in input().split()]

N,A,B = inpl()
Xi = inpl()
dist =[]
ans = 0
for i in range(N-1):
    dist.append(Xi[i+1]-Xi[i])
for i in range(N-1):
    if dist[i]*A <B:
        ans += dist[i]*A
    else:
        ans += B

print(ans)

Solution (Python):
N,A,B=map(int,input().split())
X=[int(i) for i in input().split()]
ans=0
for i in range(1,N):
    ans+=min(A*(X[i]-X[i-1]),B)
print(ans)

Solution (Python):
N,A,B = map(int,raw_input().split())

X = map(int,raw_input().split())
ans=0
for i in range(N-1):
    ans+=min([(X[i+1]-X[i])*A,B])

print ans

Solution (Python):
S1=input()
S1=S1.split()
S2=input()
S2=S2.split()
move=0
N=int(S1[0])
A=int(S1[1])
B=int(S1[2])
for i in range(N-1):
    div=int(S2[i+1])-int(S2[i])
    if (div)*A>=B:
        move+=B
    else:
        move+=A*(div)
print(move)

Solution (Python):
S1=input()
S1=S1.split()
S2=input()
S2=S2.split()
move=0
N=int(S1[0])
A=int(S1[1])
B=int(S1[2])
for i in range(N-1):
    if (int(S2[i+1])-int(S2[i]))*A>=B:
        move+=B
    else:
        move+=A*(int(S2[i+1])-int(S2[i]))
print(move)

Solution (Python):
n,a,b = map(int,input().split())
x = list(map(int,input().split()))

ans = 0
for i in range(n-1):
    if a*(x[i+1]-x[i]) < b:
        ans += a*(x[i+1]-x[i])
    else:
        ans += b
print(ans)

Solution (Python):
n,a,b,*x=map(int,open(0).read().split());print(sum(min((x[i]-x[i-1])*a,b)for i in range(1,n)))

Solution (Python):
n,a,b,*x=map(int,open(0).read().split());print(sum(min((x[i]-x[i-1])*a,b)for i in range(1,n)))

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    ans += min((x[i + 1] - x[i]) * a, b)
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    dx = (x[i + 1] - x[i]) * a
    if dx < b:
        ans += dx
    else:
        ans += b
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
for x1, x2 in zip(X, X[1:]):
    if (x2 - x1) * A < B:
        ans += (x2 - x1) * A
    else:
        ans += B
print(ans)

Solution (Python):
ai = lambda: list(map(int, input().split()))

n,a,b = ai()
x = ai()

ans = 0
for i in range(n-1):
    if a*(x[i+1]-x[i]) > b:
        ans += b
    else:
        ans += a*(x[i+1]-x[i])
print(ans)

Solution (Python):


from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

N, A, B = map(int, raw_input().split())
X = map(int, raw_input().split())

ans = 0
for i in range(N - 1):
    ans += min((X[i + 1] - X[i]) * A, B)

print ans

Solution (Python):
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, A, B] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    score = 0
    input_raw = read_func().strip().split()
    for i in range(N - 1):
        XL = int(input_raw[i])
        XR = int(input_raw[i + 1])
        if A*(XR - XL) < B:
            score += A*(XR - XL)
        else:
            score += B
    print score


if __name__ == '__main__':
    main()

Solution (Python):
n,a,b=map(int,input().split())
*l,=map(int,input().split())
v=0
for i in range(n-1):
  d=l[i+1]-l[i]
  v+=(min(d*a,b))
print(v)

Solution (Python):
def main():
    n, a, b = map(int, input().split())
    x = list(map(int, input().split()))

    ans = 0
    for i in range(1, n):
        if a * (x[i]-x[i-1]) < b:
            ans += a * (x[i]-x[i-1])
        else:
            ans += b

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B=map(int,input().split())
X=[int(i) for i in input().split()]
ans=0
for i in range(1,N):
    t=X[i]-X[i-1]
    ans+=min(B,t*A)
    
print(ans)

Solution (Python):

import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


N, A, B = map(int, input().split())
X = list(map(int, input().split()))


hirou = 0
for i in range(N-1):
    dist = X[i+1] - X[i]
    hirou +=  min(dist*A, B)


print(hirou)

Solution (Python):
N,A,B=[int(i) for i in input().split()]
X=[int(i) for i in input().split()]

res=0
for i in range(N-1):
    dist = X[i+1]-X[i]
    res += min(A*dist,B)
print(res)

Solution (Python):
a = list(map(int,input().split()))
b = list(map(int,input().split()))

su = 0
c = [0]
for  i in range(len(b)-2):
	c.append(0)

for i in range(a[0] - 1):
	c[i] = b[i+1] - b[i]

for i in range(len(c)):
	if a[2] <= c[i]*a[1]:
		su += a[2]
	else:
		su += c[i]*a[1]

print(su)

Solution (Python):
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
cost = 0
for i in range(n-1):
    cost += min(b,a*(x[i+1]-x[i]))
print(cost)

Solution (Python):
hirou = 0
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
for i in range(len(x) - 1):
    if (x[i + 1] - x[i]) * a >= b:
        hirou += b
    else:
        hirou += (x[i + 1] - x[i]) * a
print(hirou)

Solution (Python):
from sys import stderr
from functools import reduce
from operator import add
def f(): return [int(i) for i in input().split()]
def debug(*x): stderr.write(reduce(add,repr(x)).strip("()\',")+'\n')

n,a,b = f()
x = sorted(f())
ans = 0

for i in range(n-1):
    if (x[i+1] - x[i])*a > b:
        ans += b
    else:
        ans += (x[i+1]-x[i])*a

print(ans)

Solution (Python):
(n, a, b) = tuple(map(int, input().split()))
arr = list(map(int, input().split()))
res = 0
for i in range(n - 1):
    at = (arr[i + 1] - arr[i]) * a
    if at > b:
        res += b
    else:
        res += at
print(res)

Solution (Python):
n,a,b=list(map(int,input().split()))
city=list(map(int,input().split()))
t=0
for i in range(1,n):
    wt=(city[i]-city[i-1])*a
    if wt>b:
        t+=b
    else:
        t+=wt
print(t)

Solution (Python):
import collections


def solve():
    n,a,b = map(int,input().split())
    x = list(map(int,input().split()))
    ans = int()
    for i in range(1,n):
        ans += min((x[i]-x[i-1])*a,b)
    print(ans)
    return

if __name__ == "__main__":
    solve()

Solution (Python):
from math import *
import numpy as np

N,A,B=map(int,input().split())
X=list(map(int,input().split()))

t=0
for i in range(1,N):
	if (X[i]-X[i-1])*A<=B: t+=(X[i]-X[i-1])*A
	else: t+=B

print(t)

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(N-1):
  dist = X[i+1] - X[i]
  ans += min(dist*A, B)

print(ans)

Solution (Python):
N, A, B = map(int, input().split())
Xs = list(map(int, input().split()))

ans = 0
for i in range(1, N):
    ans += min(A * (Xs[i] - Xs[i - 1]), B)

print(ans)

Solution (Python):

def inpl(): return list(map(int, input().split()))

N, A, B = inpl()
X = inpl()
res = 0
for i in range(N-1):
    res += min(A*(X[i+1]-X[i]), B)
print(res)

Solution (Python):
n, a, b = map(int, raw_input().split(' '))
v = map(int, raw_input().split(' '))

res = 0
for i in range(0, n - 1):
	if (v[i + 1] - v[i]) * a > b:
		res += b
	else:
		res += (v[i + 1] - v[i]) * a

print res

Solution (Python):
N,A,B = map(int,raw_input().split())
X = map(int,raw_input().split())

result=0
for i in range(N-1):
    if (X[i+1]-X[i])*A > B:
        result+=B
    else:
        result+=(X[i+1]-X[i])*A
print result

Solution (Python):
[n,a,b]=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[]
for i in range(n-1):
 z=(x[i+1]-x[i])*a
 if z<b:
   y.append(z)
 else:
   y.append(b)
print(sum(y))

Solution (Python):
N, A, B = map(int, input().split(" "))
X = list(map(int, input().split(" ")))

diff_X = [i-j for i,j in zip(X[1:], X[:-1])]

res = 0
for i in range(len(diff_X)):
    if A*diff_X[i] < B:
        res += A*diff_X[i]
    else:
        res += B

print(res)

Solution (Python):
import numpy as np

n, a, b = map(int, input().split())
towns = list(map(int, input().split()))
print(sum(np.minimum(np.diff(towns) * a, b)))