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.



Sample input:
4 2 5
1 2 5 7


Sample output:
11

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
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
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,A,B = MI()
    X=LI()
    now = X[0]
    ans = 0
    for x in X:
        ans += min((x-now)*A, B)
        now = x
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,A,B=[int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().split()]
ans=0

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

Submission status: Accepted

Solution code:
#52d
N,A,B = map(int, input().split())
X_list = [int(e) for e in input().split()]

diff_X_list = [X_list[i]-X_list[i-1] for i in range(1,N)]

ans = 0
for diff_X in diff_X_list:
    if diff_X * A >= B:
        ans += B
    else:
        ans += diff_X * A
        
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
X = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
D = [0]
for i in range(N-1):
    D.append(X[i+1]-X[i])

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, A, B = MAP()
C = MAP()

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

print(ans)

Submission status: Accepted

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

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

cost = 0
# 隣町への移動
for i in range(N-1):
    # 隣待ちへの徒歩での移動コストと、テレポートでの移動コストを比較して、
    # 小さい方を採用する
    cost += min((X[i+1]-X[i])*A, B)
    
print(cost)

Submission status: Accepted

Solution code:
import sys

n, a, b, *x = map(int, sys.stdin.read().split())

def main():
    border = (b + a - 1) // a

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

    return res

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])*A
    if l>B:
        ans+=B
    else:
        ans+=l

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().strip().split()]
X = [int(x) for x in input().strip().split()]
p = X[0]
ans = 0
for x in X[1:]:
    c = (x - p) * A
    if c <= B:
        ans += c
    else:
        ans += B
    p = x
print(ans)

Submission status: Accepted

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

arr = list()
for i, x in enumerate(X):
    if i == 0:
        continue
    arr.append(min((X[i] - X[i - 1]) * A, B))
print(sum(arr))

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
n, a, b = [int(i) for i in sys.stdin.readline().split()]
x_ls = [int(i) for i in sys.stdin.readline().split()]
diff_ls = []
for i, x in enumerate(x_ls[:-1]):
    diff_ls.append((x_ls[i+1] - x) * a)
diff_ls = [i if i < b else b for i in diff_ls]
print(sum(diff_ls))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.buffer.readline


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

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

    print(c)


main()

Submission status: Accepted

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

print(sum([min((X[i]-X[i-1]) * A, B) for i in range(1, N)]))

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, A: int, B: int, X: "List[int]"):
    distance = []
    for i in range(1,N):
        distance.append(X[i]-X[i-1])
    
    answer =0 
    for d in distance:
        answer += min(d*A,B)
    print(answer)

    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))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

n,a,b = [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int,stdin.readline().rstrip().split()))

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

print(point)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
li = list(map(int, input().split()))
fatigue = 0
for i in range(n-1):
    fatigue += min(b, a*(li[i+1]-li[i]))

print(fatigue)

Submission status: Accepted

Solution code:
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 y:
    if i<=b:
        ans+=i
    else:
        ans+=b

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    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)
resolve()

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
# 典型dp きりみんちゃんの放送からきました
n, a, b = map(int, input().split())
arr = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

dif=[x[ind+1]-x[ind] for ind in range(len(x)-1)]
c=0
for i in dif:
    if(i*a > b):
        c+=b
    else:
        c+=i*a
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, A, B = map(int, input().split(' '))
X = list(map(int, input().split(' ')))

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

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
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)

Submission status: Accepted

Solution code:
def examD():
    N, A, B = LI()
    X = LI()
    cur = int(0)
    for i in range(N-1):
        cur += min(A*(X[i+1]-X[i]),B)
    print(cur)

import sys
import copy
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N, A, B = map(int, input().split())
X = np.array(input().split(), np.int64)

answer = np.minimum((X[1:] - X[:-1]) * A, B)

print(answer.sum())

Submission status: Accepted

Solution code:
n,a,b = map(int,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)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

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

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

print(sum(d))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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
#import numpy as np
#import sympy as syp(素因数分解とか)
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(): #startline-------------------------------------------
    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() #endline===============================================

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
# ABC052D - Walk and Teleport (ARC067D)
def main():
    # choose A * dist(i, j) or B greedily
    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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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