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):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, 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):
    gap = X[i+1] - X[i]
    hA = gap * A
    if hA < B:
        ans += hA
    else:
        ans += B
print(ans)

Solution (Python):


import math



from collections import deque
from collections import Counter




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

Solution (Python):
import sys
from collections import defaultdict, deque
import math


from bisect import bisect_left, bisect_right





input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n, a, b = getList()
    nums = getList()

    ans = 0
    for i, j in zip(nums, nums[1:]):
        if a * (j - i) >= b:
            ans += b
        else:
            ans += a * (j - i)

    print(ans)

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    
    solve()

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)

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

if __name__ == '__main__':
    run()

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N, A, B = in_nn()
    X = list(in_nn())

    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)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np


N, A, B = map(int, input().split())
X = np.array(list(map(int, input().split())))
print(np.minimum((X[1:] - X[:-1]) * A, B).sum())

Solution (Python):
N, A, B = map(int, input().split())
X = map(int, input().split())
curr = next(X)
ans = 0
for x in X:
    if (x - curr) * A <= B:
        ans += (x - curr) * A
    else:
        ans += B
    curr = x
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().split()))

dp = [float("inf") for _ in range(N)]
dp[0] = 0

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

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

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

print(ans)

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):
    distance = x[i+1] - x[i]
    if distance*a < b:
        ans += distance * a
    else:
        ans += b
print(ans)

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

P=0
Q=N-1
T=0

C=0
for _ in range(N-1):
    if T==0:
        P+=1
        J=A*(X[P]-X[P-1])
    else:
        Q-=1
        J=A*(X[Q+1]-X[Q])

    if J<=B:
        C+=J
    else:
        C+=B
        T^=1

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

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

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

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

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

print(s)

Solution (Python):
import numpy as np
import sys

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

if n == 2:
    print(min((x[1] - x[0]) * a, b))
    sys.exit()

left = 0
right = n - 1
curr = 0
cnt = 0
reverse = False


while left < right:
    if not reverse:
        if (x[curr + 1] - x[curr]) * a > (x[right] - x[right - 1]) * a + b:
            reverse = True
            cnt += b
            curr = right
            left += 1
        elif (x[curr + 1] - x[curr]) * a <= b:
            left += 1
            cnt += (x[curr + 1] - x[curr]) * a
            curr = left
        else:
            left += 1
            cnt += b
            curr = left
    else:
        if (x[curr] - x[curr - 1]) * a > (x[left + 1] - x[left]) * a + b:
            reverse = False
            cnt += b
            curr = left
            right -= 1
        elif (x[curr] - x[curr - 1]) * a <= b:
            right -= 1
            cnt += (x[curr] - x[curr - 1]) * a
            curr = right
        else:
            right -= 1
            cnt += b
            curr = right

print(cnt)

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

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):
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

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

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

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

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

N,A,B = map(int,readline().split())
X = list(map(int,readline().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())
dat = list(map(int, input().split()))
cost = 0
cur = dat[0]
for i in range(n):
    cost += min(b, a*(dat[i]-cur))
    cur = dat[i]
print(cost)

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

Solution (Python):
import sys


import math
import collections

import bisect
import itertools
import fractions

import copy
import heapq
import decimal

import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    n, a, b = ns()
    x = na()

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

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

dp = [float("INF") for _ in range(n)]
dp[0] = 0

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

print(dp[-1])

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

point = 0

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

print(point)

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

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

    ret = 0
    curr = next(X)
    for x in X:
        ret += min((x - curr) * A, B)
        curr = x
    print(ret)


if __name__ == '__main__':
    main()

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

ans = 0
for i in range(1,n+1):
  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())
x = list(map(int,input().split()))
"""
率直に左からまわる.
"""
ans = 0
now = x[0]
for i in range(1, n):
	kyori = x[i]-now
	ans += min(a*kyori, b)
	now = x[i]
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,A,B = inpl()
a = inpl()
res = 0
for i in range(n-1):
    tmp = B
    if (a[i+1]-a[i]) * A <= B:
        tmp = (a[i+1]-a[i]) * A
    res += tmp
print(res)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

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

ans = 0
for i in range(N - 1):
    ans += min(B, A * (X[i + 1] - 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(1,N):
  step = min(A*(X[i]-X[i-1]),B)
  ans += step
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()))
ans = 0
old = X[0]
for i in range(1,N):
  a = (X[i]-old)*A
  ans += min(a,B)
  old = X[i]
print(ans)

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

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

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

l.sort(reverse=True)
ans = 10**18
walk = sum(l)

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

print(ans)

Solution (Python):
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a, b = map(int, input().split())
    X = list(map(int, input().split()))

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


if __name__ == '__main__':
    resolve()

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):
from sys import stdin
def main():
    
    readline=stdin.readline
    n,a,b=map(int,readline().split())
    x=list(map(int,readline().split()))

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

Solution (Python):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
D = [r - l for l, r in zip(X, X[1:])]

ans = sum(min(A * d, B) for d in D)
print(ans)

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

res = 0
cur = x_list[0]
for x in x_list[1:]:
    res += B if (x - cur) * A > B else (x-cur)*A
    cur = x
print(res)

Solution (Python):




import math
import sys
import bisect
import heapq  
from collections import deque
inf = 10 ** 15
mod = 10 ** 9 + 7
n,a,b = map(int, input().split())
if b <= a:
    print(b*(n-1))
    sys.exit()
x = list(map(int, input().split()))
dp = [inf for i in range(n+1)] 
dp[1] = 0
for i in range(1,n):
    dp[i+1] = dp[i] + min((x[i]-x[i-1])*a, b)
print(dp[n])

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)









n,a,b=n1()
X=n1()

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

Solution (Python):

printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

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]

    if b >= a*dist:
        ans += a*dist
    else:
        ans += b

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]






n,a,b=mii()
arr=limii()
cnt=0
for i in range(n-1):
    if (arr[i+1]-arr[i])*a>b:
        cnt+=b
    else:
        cnt+=(arr[i+1]-arr[i])*a
print(cnt)

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

fatigue = [0] * n

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

print(fatigue[n - 1])

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

res = 0
for i in range(1, len(x)):
    a_c = (x[i]-x[i-1])*a
    b_c = b
    if a_c > b_c:
        res += b_c
    else:
        res += a_c

print(res)

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

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

ans = 0
for x, y in zip(City, City[1:]):
    if y - x <= d:
        ans += (y - x) * A
    else:
        ans += B
print(ans)

Solution (Python):
import math








import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        N,A,B=map(int,input().split())
        X=list(map(int,input().split()))
        if A>=B:
            return (N-1)*B
        else:
            ans=0
            merit=math.ceil(B/A)
            for i in range(N-1):
                d=X[i+1]-X[i]
                if d>=merit:
                    ans+=B
                else:
                    ans+=A*d
            return ans
    print(main())


    
resolve()

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

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

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

print(ans)

Solution (Python):
import sys

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

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

print(ans)

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

A = np.array(x)
walk_d = np.diff(A, n=1) * a
ans = 0
for num in walk_d:
  ans += min(num,b)
print(ans)

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

cost=0
tp=n-1
for i in range(n-1):
    walk=(x[i+1]-x[i])*a
    if walk<b:
        cost+=walk
        tp-=1

cost+=tp*b
print(cost)

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

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

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

if __name__ == '__main__':
    main()

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

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

if __name__ == '__main__':
    solve()

Solution (Python):
import math
n,a,b = map(int,input().split())
li = list(map(int,input().split()))
sakai = math.ceil(b/a)
ans = 0
for i,l in enumerate(li):
    if i == 0:
        continue
    
    if l-li[i-1]>=sakai:
        ans += b
    else:
        ans += a*(l-li[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

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

print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, a, b = map(int, readline().split())
x = list(map(int, readline().split()))
ans = 0
for bf, af in zip(x, x[1:]):
    ans += min((af - bf) * a, b)
print(ans)

Solution (Python):


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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
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):
import sys
def input(): return sys.stdin.readline().rstrip()
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):
def resolve():
    '''
    code here
    '''
    N, A, B = [int(item) for item in input().split()]
    X_list = [int(item) for item in input().split()]

    memo = 0

    for i in range(N-1):
        w_cost = A * (X_list[i+1] - X_list[i])
        memo = min(memo + w_cost, memo + B)       
    
    print(memo)

if __name__ == "__main__":
    resolve()

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

print(ans)

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

d = [x[i+1] - x[i] for i in range(n-1)]

s = 0

for i in d:
    if a*i < b:
        s += a*i
    else:
        s += b

print(s)

Solution (Python):

import sys


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

    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())
X = [int(x) for x in input().split()]
tired = 0
x_ = X[0]
for x in X[1:]:
    d = x - x_
    tired += b if b <= d * a else d * a
    x_ = x
print(tired)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, a, b = map(int, input().split())
    X = list(map(int, input().split()))

    dist = [0] * (n - 1)
    for i in range(n - 1):
        dist[i] = X[i + 1] - X[i]

    res = 0
    for d in dist:
        if d * a <= b:
            res += d * a
        else:
            res += b

    print(res)


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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N, A, B = MI()
    X = LI()
    ans = 0

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

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

print(ans)

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

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




INF = int(1e18)

dp = [INF for _ in range(N + 1)]
dp[0] = 0

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

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

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

ans=0

for i in range(n-1):
    dis=lis[i+1]-lis[i]
    if dis*a<=b:
        ans+=dis*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):
    l=X[i+1]-X[i]
    ans+=min(l*A,B)
print(ans)

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

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

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

Solution (Python):
import sys
import math  
import bisect  
import queue  


def input():
    return sys.stdin.readline().rstrip()


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

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

    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)