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())
l = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    dx = a * (l[i+1] - l[i])
    if b < dx:
        ans += b
    else:
        ans += dx
print(ans)

Solution (Python):
N,A,B = map(int,input().split())
lsX = list(map(int,input().split()))
ans = 0
for i in range(1,N):
    ans += min((lsX[i] - lsX[i-1])*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(n - 1):
    res += min(b, (x[i + 1] - x[i]) * a)

print(res)

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()))
X = list(map(int,input().split()))

ans = 0
for s,e in zip(X[:-1],X[1:]):
    ans += min(B,A*(e-s))
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):
    ans += min(a * (x[i] - x[i-1]), 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):
def main():
	N, A, B = [int(n) for n in input().split(" ")]
	X = [int(x) for x in input().split(" ")]
	D = []
	for i in range(1, len(X)):
		D.append(X[i] - X[i - 1])
	print(sum([min(A * d, B) for d in D]))

main()

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



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):
    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()))
print(sum(min(A*(X[i+1]-X[i]),B) for i in range(N-1)))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

N, A, B = na()
X = na()
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()))

sa_cost = [0] * (N - 1)
for i in range(N - 1):
    sa_cost[i] = (X[i + 1] - X[i]) * A


ans = 0
for i in range(len(sa_cost)):
    if sa_cost[i] <= B:
        ans += sa_cost[i]
    else:
        ans += B

print(ans)

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

print(Sum)

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

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

	else:
		cost+=B 

print(cost)

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

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

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

Solution (Python):
num_towns, cost_walk, cost_warp = map(int, input().split())
positions = list(map(int, input().split()))

total_cost = 0
for p1, p2 in zip(positions[:-1], positions[1:]):
    c_walk = (p2 - p1) * cost_walk
    if c_walk < cost_warp:
        total_cost += c_walk
    else:
        total_cost += cost_warp

print(total_cost)

Solution (Python):
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
ans = 0
x = X[0]
for i in range(N):
    ans += min((X[i]-x)*A, B)
    x = X[i]
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(A*(X[i+1]-X[i]), B)
print(ans)

Solution (Python):
N, A, B = map(int, input().split())
X = [int(x) for x in input().split()]
ans = 0
for x,y in zip(X[:N-1],X[1:]):
    if (y-x) * A < B:
        ans += (y-x) * A
    else:
        ans += 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(a*(x[i+1]-x[i]),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()))
  
  ans = 0
  for i in range(n-1):
    ans += min(a * (x[i+1] - x[i]), b)
  
  print(ans)
  
  
  
  
  
if __name__ == "__main__":
  main()

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

diff = []
for i in range(n-1):
    diff.append(a*(L[i+1]-L[i]))

cnt = 0
for i in range(n-1):
    if diff[i] > b:
        cnt +=1
diff.sort()

print(sum(diff[:n-1-cnt]) + b*cnt)

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

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

print(sum(d2))

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

print(ans)

Solution (Python):
import sys
from heapq import heappush, heappop
def input(): return sys.stdin.readline().strip()


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




if __name__ == "__main__":
    main()

Solution (Python):
n, a, b = map(int, input().split())
town = list(map(int, input().split()))
dist = []
for i in range(n-1):
  dist.append((town[i+1]-town[i])*a)

ans = 0
for i in range(n-1):
  ans += min(dist[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):
    ans += min((x[i]-x[i-1])*a,b)
print(ans)

Solution (Python):

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

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

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

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

print(ans)

Solution (Python):


n,a,b = map(int, raw_input().split())
xis = map(int ,raw_input().split())
cost = 0
for u,v in zip(xis,xis[1:]):
	cost += min((v-u)*a, b)
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):
    aa = (x[i+1] - x[i]) * a
    if aa < b:
        ans += aa
    else:
        ans += b

print(ans)

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

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
town = X[0]
for i in range(1,N):
    ans += min(B, (X[i]-town)*A)
    town = X[i]
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):
    num=x[i+1]-x[i]
    ans+=min(b,a*num)
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):
    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=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 = [int(s) for s in input().split()]
x_list = [int(s) for s in input().split()]
ans = 0
for i in range(n - 1):
    ans += min(a * (x_list[i + 1] - x_list[i]), b)
print(ans)

Solution (Python):
k=0
def s(a):
  return min(a*A,B)
N,A,B=map(int,input().split())
L=list(map(int,input().split()))
for i in range(N-1):
  k+=s(L[i+1]-L[i])
print(k)

Solution (Python):
n,a,b = 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=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):
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):
import sys
N,A,B = map(int,input().split())
array = list(map(int,input().split()))

cost = 0
for J in range(len(array)-1):
        walk_cost = (array[J+1] - array[J])*A
        if walk_cost < B:
            cost += walk_cost
        else:
            cost += B
print(cost)

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

if not ( 2 <= N <= 10**5 and 1 <= A <= 10**9 and 1 <= B <= 10**9 ): sys.exit()
for I in range(len(array)):
    if not ( 1 <= array[I] <= 10**9 ): sys.exit()
    if array[I] != array[-1]:
       if not ( array[I] < array[I+1] ): sys.exit()

cost = 0
for J in range(len(array)):
    if array[J] != array[-1]:
        walk_cost = (array[J+1] - array[J])*A
        if walk_cost < B:
            cost += walk_cost
        else:
            cost += B
print(cost)

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

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 += B
    else:
        ans += (X[i] - X[i-1]) * A
print(ans)

Solution (Python):
n, a, b = map(int, input().split())
xs = list(map(int, input().split()))
res = 0
for i in range(n-1):
    walk = (xs[i+1]-xs[i])*a
    if walk <= b:
        res += walk
    else:
        res += 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):
    d = X[i] - X[i - 1]
    if d * A > B:
        ans += B
    else:
        ans += d * A
print(ans)

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

res = 0
pos = x[0]
for town in x[1:]:
    res += min((town - pos) * a, b)
    pos = town

print(res)

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


ans = 0
for x1,x2 in zip(xl[:-1],xl[1:]):
    diff = x2-x1
    walk_cost = diff*a
    ans += min(walk_cost, b)

print(ans)

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, A, B, *X = map(int, read().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)
    return


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(len(X)-1):
  c = A*(X[i+1]-X[i])
  if c < B:
    ans+=c
  else:
    ans+=B
print(ans)

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

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

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

Solution (Python):
import sys

def main():
    N,A,B=map(int,input().split())
    towns=list(map(int,sys.stdin.readline().strip().split()))
    f=lambda x:min(A*x,B)
    fl=0
    for x in range(N-1):
        fl+=f(towns[x+1]-towns[x])
    print(fl)

if __name__=='__main__':
    main()

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N,A,B = MI()
X = LI()



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())
num = list(map(int, input().split()))

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

print(ans)

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

    print(res)
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):
    ans += min(a*(x[i+1]-x[i]), b)
print(ans)

Solution (Python):
N,A,B = map(int,input().split())
ARR = list(map(int,input().split()))
def calculate(n,a,b,arr):

    result = 0
    for i in range(1,n):
        result += min(B,(arr[i] - arr[i-1]) * A)

    print(result)

calculate(N,A,B,ARR)

Solution (Python):
n,a,b=list(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):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, A, B = read_ints()
    X = read_ints()
    answer = 0
    for i in range(1, N):
        answer += min(A*(X[i]-X[i-1]), B)
    return answer


if __name__ == '__main__':
    print(solve())

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):
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]
    if d*A<=B:
        ans+=d*A
    else:
        ans+=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):
    d = X[i + 1] - X[i]
    ans += min(a * d, b)

print(ans)

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n, a, b = LI()
	pos, *x_list = LI()
	cost = 0
	for x in x_list:
		if abs(x-pos)*a < b:
			cost += abs(x-pos) * a
		else:
			cost += b
		pos = x
	print(cost)


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B,*X = map(int, open(0).read().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()))
xp = x[0]
ans = 0

for xi in x[1:]:
  ans += min((xi-xp)*a, b)
  xp = xi
  
print(ans)

Solution (Python):
import sys;input = lambda : sys.stdin.readline()
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]
    ans += min(b, d * a)
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):
    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 = map(int,input().split())
X = list(map(int,input().rstrip().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 = tuple(map(int, input().split()))
ans = 0
for x0, x1 in zip(X[:n-1], X[1:]):
    ans += min(b, a*(x1-x0))
print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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

    print(ans)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
n,a,b,*l=map(int,open(0).read().split())
t,p=0,l[0]
for i in l:
  t+=min(a*(i-p),b)
  p=i
print(t)

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):
N, A, B = map(int,input().split())
XN = list(map(int,input().split()))

ans = 0
for n in range(N-1):
  xl = XN[n]
  xr = XN[n+1]
  dist = xr - xl
  ans += min(dist*A, B)
print(ans)

Solution (Python):
t = list(map(int, input().split()))
k = list(map(int, input().split()))

h = 0
for i in range(0,len(k)-1):
    if (k[i+1]-k[i])*t[1] > t[2]:
        h += t[2]
    else:
        h += (k[i+1]-k[i])*t[1]
print(h)

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

town = list(map(int, input().split()))
diff = [0]*(N+1)
for i in range(1, N):
    diff[i] = town[i] - town[i-1]

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

print(sumz)

Solution (Python):
def main():
    n, a, b, *x = map(int, open(0).read().split())
    ans = 0
    it = iter(x)
    nw = it.__next__()
    for nx in it:
        ans += min(b, (nx - nw) * a)
        nw = nx

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, a, b, *x = map(int, open(0).read().split())
    ans = 0
    it = iter(x)
    nw = it.__next__()
    for nx in it:
        c = (nx - nw) * a
        if c > b:
            ans += b
        else:
            ans += c
        nw = nx

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, a, b, *x = map(int, open(0).read().split())
    ans = 0
    for i, j in zip(x, x[1:]):
        if a * (j - i) > b:
            ans += b
        else:
            ans += a * (j - i)

    print(ans)


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    resolve()

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

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

print(ans)

Solution (Python):
def main():
    n, a, b = list(map(int, input().split()))
    X = list(map(int, input().split()))
    INF = float('inf')
    dp = [0] * n
    for i in range(1, n):
        dp[i] = dp[i - 1] + min(a * (X[i] - X[i - 1]), b)
    print(dp[n - 1])

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(1,n):
    ans += min(a*(x[i]-x[i-1]),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):
    tar = x[i] - x[i-1]
    ans += min(tar*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(1, n):
    ans += min((x[i] - x[i-1]) * a, b)
print(ans)

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

Solution (Python):
def main():
    n, a, b = map(int, input().split())
    x = tuple(map(int, input().split()))
    r = 0
    for i1 in range(1, n):
        dis = x[i1] - x[i1-1]
        if dis * a > b:
            r += b
        else:
            r += dis * a
    print(r)

if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N,A,B = IL()
X = IL()

MP = 0
NOW = X[0]
for x in X:
  MP += min((x-NOW)*A,B)
  NOW = x
print(MP)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n,a,b=MI()
lis=LI()
ans=0
for i in range(n-1):
    ans+=min(a*(lis[i+1]-lis[i]),b)
print(ans)

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    n,a,b=map(int,readline().split())
    x=list(map(int,readline().split()))
    y=[0]*(n-1)
    for i in range(n-1):
        y[i]=x[i+1]-x[i]

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

    print(ans)

if __name__=="__main__":
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7



N, A, B = MAP()
X = LIST()

tmp = X[0]
ans = 0
for x in X:
	ans += min((x-tmp)*A, B)
	tmp = x

print(ans)

Solution (Python):

n,a,b = map(int,input().split())
lst = list(map(int,input().split()))
cost = 0
for i,value in enumerate(lst[1:]):
	
	diff = value -lst[i]
	cost += min(a*diff,b)
	
print(cost)

Solution (Python):
def move(X,N,A,B):
    output = 0
    for i in range(N-1):
        output += min(A*(X[i+1]-X[i]),B)

    return output

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

    print(move(X,N,A,B))

if __name__ == "__main__":
    main()