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):
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




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

Solution (Python):
import sys

N,A,B=(int(x) for x in input().split())

x=[int(t.strip()) for t in input().split()]

gap=[]
for i in range(N-1):
	gap.append(x[i+1]-x[i])

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

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

I = []
for i in range(N-1):
    I.append(X[i+1]-X[i])

M = X[N-1]-X[0]
I_srt = sorted(I)
I_srt.reverse()

I_sum = [0]
for i in range(N-1):
    I_sum.append(I_srt[i]+I_sum[i])


ans = min([(M-I_sum[i])*A + B*i for i in range(N)])

print(ans)

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

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

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

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

ans = 0

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

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

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

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

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

Solution (Python):

import sys


def solve(N: int, A: int, B: int, X: "List[int]"):
    e = 0
    for i in range(1, N):
        d = X[i] - X[i-1]
        if d * A >= B:
            e += B
        else:
            e += d * A
    print(e)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    X = [int(next(tokens)) for _ in range(N)]  
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

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

if __name__ == '__main__':
    main()

Solution (Python):
n,a,b = map(lambda x: int(x), input().split())
x = list(map(lambda x: int(x), input().split()))
last = x[0]
ans = 0
for i in x:
    diff = i - last
    last = i
    ans += min(diff*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):
    ps = x[i+1]-x[i]
    if ps*a >= b:
        ans +=b
    else:
        ans += ps*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(A*(X[i+1]-X[i]),B)

print(ans)

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
N,A,B=map(int,input().split())
X=tuple(map(int,input().split()))
k=B//A
a=0
for i in range(N-1):
    if X[i+1]-X[i]>k:
        a+=B
    else:
        a+=(X[i+1]-X[i])*A
print(a)

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

Solution (Python):
def main():
    N, A, B = (int(i) for i in 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(A*dist,B)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):

import sys


def solve(N: int, A: int, B: int, X: "List[int]"):
    ans = 0

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

    print(ans)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    X = [int(next(tokens)) for _ in range(N)]  
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

Solution (Python):

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

ans = 0

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

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()))

if a >= b:
    thres = 0
else:
    thres = b // a

sub = []
for i in range(n-1):
    tmp = x[i+1] - x[i]
    sub.append(tmp)

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

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

fatigue = 0
for i, x in enumerate(list_x):
  if i > 0:
    if (x - list_x[i - 1]) * a < b:
      fatigue += a * (x - list_x[i - 1])
    else:
      fatigue += b
print(fatigue)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,a,b = inpl()
x = inpl()
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)

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()))
y=[]
for i in range(n-1):
    y.append(a*(x[i+1]-x[i]))
ans=0
for i in range(len(y)):
    if y[i]<=b:
        ans+=y[i]
    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(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()))
y=[int(x[i]-x[i-1]) for i in range(1,n)]
answer=0
for i in y:
  if a*i<=b:
    answer+=a*i
  else:
    answer+=b
print(answer)

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

print (ans)

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

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

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

Solution (Python):
n,a,b=[int(j) for j in input().split()]
x=[int(j) for j in 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())
cities = list(map(int, input().split()))
hirou = 0
for index in range(n-1):
  kyori = cities[index+1] - cities[index]
  if kyori*a > b:
    hirou += b
  else:
    hirou += kyori * a
print(hirou)

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

for _ in range(N-1):
    walk = (X[0] - here) * A
    if walk > B:
        ans += B
    else:
        ans += walk
    here = X.pop(0)

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
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)]
mod = 1000000007


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


print(ret)

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

Solution (Python):
n,a,b,*x=map(int,open(0).read().split());print(sum(min(b,a*(j-i))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, j in zip(x[:-1], x[1:]):
    c = min(A*(j-i), B)
    ans += c

print(ans)

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

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

if A >= B:
    print(B*(N-1))
else:
    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())
towns = list(map(int ,input().split()))
sum_e = 0
for i in range(1, N):
  dis = towns[i] - towns[i-1]
  if dis * A > B:
    sum_e += B
  else:
    sum_e += dis * A
print(sum_e)

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

diff = [X[n + 1] - X[n] for n in range(N - 1)]

ans = 0
for n in range(N - 1):
    if diff[n] * A > B:
        ans += B
    else:
        ans += diff[n] * 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(a * (X[i+1] - X[i]), b)
print(ans)

Solution (Python):

 

s = [input() for i in range(2)]
 
N = int(s[0].split()[0])
A = int(s[0].split()[1])
B = int(s[0].split()[2])
X = s[1].split()
 
F = 0
 

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

print(F)

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

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

print(c)

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


if __name__ == "__main__":
    main()

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

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

print(res)

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

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

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

print(ans)

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

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

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

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

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


X = [int(x) for x in input().split()]


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

Solution (Python):
def main():
    n,a,b = map(int,input().split())
    x = [int(x_) for x_ in input().split()]
    now = x[0]
    ans = 0
    for i in range(1,n):
        if (x[i]-now)*a<=b:
            ans += (x[i]-now)*a
        else:
            ans += b
        now = x[i]
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
def main():

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

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

Solution (Python):
n, a, b = [int(i) for i in input().split()]
x = [int(i) for i in 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):
    tmp = x[i+1] - x[i]
    if tmp * A > B:
        ans += B
    else:
        ans += tmp * A

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

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

Solution (Python):
N, A, B = map(int, input().split())
X = [int(_) for _ in input().split()]
ans = 0
for i in range(1, N):
    walk = (X[i]-X[i-1])*A
    teleport = B
    if walk < teleport:
        ans += walk
    else:
        ans += teleport

print(ans)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

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

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

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

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

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 permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

fatigue=0

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

print(fatigue)

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):

import sys
input = sys.stdin.readline

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b, c, d = LI()
    print(max(a * b, c * d))
    return


def B():
    _ = II()
    s = S()
    d = {}
    d["I"] = 1
    d["D"] = -1
    ans = 0
    now = 0
    for i in s:
        now += d[i]
        ans = max(ans, now)
    print(ans)
    return


def C():
    def primes2(n):
        """https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n/3035188
        """ Returns  a list of primes < n """
        sieve = [True] * (n//2)
        for i in range(3,int(n**0.5)+1,2):
            if sieve[i//2]:
                sieve[i*i//2::i] = [False] * ((n-i*i-1)//(2*i)+1)
        return [2] + [2*i+1 for i in range(1,n//2) if sieve[i]]
    n = II()
    prime = primes2(n+1)
    d = []
    for i in prime:
        b = n
        f = 0
        while b:
            b = b // i
            f += b
        d.append(f%mod)
    ans = 1
    for i in d:
        ans *= (i + 1)
        ans %= mod
    print(ans)
    return


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


if __name__ == '__main__':
    D()

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

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

print(total_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 = (int(x) for x in input().split())
X_arr = [int(x) for x in input().split()]

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

print(ans)

Solution (Python):
n, a, b = [int(i) for i in input().split()]
citys = [int(i) for i in input().split()]

res = 0

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

print(res)

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

from collections import defaultdict
import sys


def main():
    num, move, telepote = map(int, input().split())
    data = list(map(int, input().split()))

    ans = 0
    for i in range(num - 1):
        ans += min(telepote, move * (data[i + 1] - data[i]))

    print(ans)



if __name__ == '__main__':
    main()

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(a * (x[i + 1] - x[i]), b)
print(cost)

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: int, B: int, X: "List[int]"):
    ret = 0
    cur = X[0]
    for i in range(1, N):
        ret += min(A * (X[i] - X[i - 1]), B)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = int(next(tokens))  
    B = int(next(tokens))  
    X = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

Solution (Python):



import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

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

walk = [xj-xi for xi,xj in zip(x,x[1:]) if a*(xj-xi) < b]

w = sum(walk)*a
t = (n-1-len(walk))*b

print(t+w)

Solution (Python):
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque

from itertools import product

from itertools import permutations

from itertools import combinations

from itertools import accumulate
from bisect import bisect_left, bisect_right

import re




def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 



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

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

print(ans)

Solution (Python):
z=list(map(int,input().split()))
X=list(map(int,input().split()))
N,A,B=z[0],z[1],z[2]
a=1
p=0
while True:
    p+=min((X[a]-X[a-1])*A,B)
    a+=1
    if a==N:
        break
print(p)

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

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

Solution (Python):
def main():
    n, a, b = map(int, input().split(" "))
    x = list(map(int, input().split(" ")))
    fatigue = 0
    current = x[0]

    for x_i in x[1:]:
        fatigue = fatigue + min((x_i - current) * a, b)
        current = x_i
    print(fatigue)


if __name__ == '__main__':
    main()

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

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((X[i] - X[i - 1]) * A, B)

print(ans)

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

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

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

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:]):
  ans += min(a * (x2 - x1), 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 read_input():
    n, a, b = map(int, input().split())
    xlist = list(map(int, input().split()))
    return n, a, b, xlist


def submit():
    n, a, b, xlist = read_input()

    tired = 0

    for xs, xe in zip(xlist, xlist[1:]):
        dist = xe - xs

        if dist*a < b:
            tired += dist*a
        else:
            tired += b

    print(tired)
    return


if __name__ == '__main__':
    submit()

Solution (Python):
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18

N, A, B = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))

X = np.array(X)
ans = 0
for d in np.diff(X):
    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(B,A*(X[i+1]-X[i]))
print(ans)