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:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


def calculate(a):
    s = 0
    for i in range(len(a)):
        for k in range(i+1,len(a)):
            s+=(a[i]*a[k])
    return s

#n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
n,a,b = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
s = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
ans = 0
for i in range(n-1):
    ans+=min(b,(s[i+1]-s[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(a*(x[i+1]-x[i]), b)
print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
def factor(n):
    i = 2
    m = n
    while m >= i:
        while m%i == 0:
            m //= i
            d[i] += 1
            d[i] %= mod
            if m < i:break
        i += 1
n = I()
d = defaultdict(int)
for i in range(2,n+1):
    factor(i)
ans = 1
for i in d.values():
    ans *= i+1
    ans %= mod
print(ans)
"""

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

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
from collections import deque
X=deque(X)
cost=0
now=X.popleft()
while len(X)>0:
    if (X[0]-now)*A<=B:
        cost+=(X[0]-now)*A
    else:cost+=B
    now=X.popleft()
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):
  if a*(x[i+1]-x[i]) > b:
    ans = ans+b
  else:
    ans = ans+a*(x[i+1]-x[i])
    
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):
  s=A*(X[i]-X[i-1])
  if s<=B:
    ans+=s
  else:
    ans+=B
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import heapq
from collections import Counter, defaultdict

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, a, b = LI()
X = LI()
C = []
for i in range(n - 1):
    C.append(X[i + 1] - X[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

X = list(map(int, input().split()))
X = [x - X[0] for x in X]

C = 0

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

print(C)

Submission status: Accepted

Solution code:
def solve():
    [N,A,B] = [int(n) for n in input().split()]
    X = [int(x) for x in input().split()]
    
    ans = 0

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

    return ans


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

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:
# -*- coding: utf-8 -*-

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X_arr = list(map(int, input().split()))
X_diff = []
for i in range(N-1):
    X_diff.append(X_arr[i+1] - X_arr[i])
# print(X_diff)
ans = 0
for d in X_diff:
    if d * A < B:
        ans += d * A
    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(A * (X[i] - X[i - 1]), B)

print(ans)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#横にn個入力
n, a, b = map(int, input().split())
x = input().split()
x = [int(m) for m in x]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N, A, B = li_input()
    X = li_input()

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


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(cost)

Submission status: Accepted

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

print(sum(cost))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


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


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def d_walk_and_teleport(N, A, B, X):
    # 西から東に1つずつ、歩くかテレポートのどちらか疲労しない方で進む
    ans = sum([min(A * (X[k + 1] - X[k]), B) for k in range(N - 1)])
    return ans

N,A,B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print(d_walk_and_teleport(N, A, B, X))

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

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

print(ans)

Submission status: Accepted

Solution code:
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

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

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

Submission status: Accepted

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

ans = 0
now = X[0]
for x in X[1:]:
    d = x - now
    if d*A < B:
        ans += d*A
    else:
        ans += B
    now = x
print(ans)

Submission status: Accepted

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

print(num)

Submission status: Accepted

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

Submission status: Accepted

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

arr = map(int,raw_input().split())

ans = 0

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

print ans

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
import queue
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A, B, X):
    ans = 0
    c = X[0]
    for x in X[1:]:
        ac = A*(x - c)
        if ac > B:
            ans += B
        else:
            ans += ac
        c = x

    return ans


def main():
    N, A, B = read_int_n()
    X = read_int_n()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import deque

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

INF = float("inf")

dist = deque(X)

next_x = +1
i = 0
ans = 0
while len(dist) != 1:

    if A*abs(dist[i+next_x] - dist[i]) <= B:
        ans += A*abs(dist[i+next_x] - dist[i])
        if next_x == 1:
            dist.popleft()
            i = 0
        else:
            dist.pop()
            i = len(dist)-1
    else:
        ans += B
        if next_x == 1:
            dist.popleft()
            i = len(dist)-1
        else:
            dist.pop()
            i = 0
        
        next_x = -next_x
        
print(ans)

Submission status: Accepted

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

ans=0

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

print(ans)

Submission status: Accepted

Solution code:
n, a, b = input().split(" ")
n = int(n)
a = int(a)
b = int(b)
xs = input().split(" ")
m = list()
for x in xs:
	m.append(int(x))

fatigue = list()
for index, x in enumerate(m):
	if index < len(m) - 1:
		dist = abs(m[index + 1] - x)
		fatigue.append(min((a * dist), b))

print(sum(fatigue))

Submission status: Accepted

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

print(sum([min(a * (v - u), b) for u, v in zip(x[:-1], x[1:])]))

Submission status: Accepted

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

acc = 0 
for u, v in zip(x[:-1], x[1:]):
    acc += min(a * (v - u), b)

print(acc)

Submission status: Accepted

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

acc = 0
c = next(x)
for p in x:
    d = p - c
    acc += min(a * d, b)
    c = p
    
print(acc)

Submission status: Accepted

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

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

Submission status: Accepted

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

score = 0
telepo = b
for i in range(len(X)-1):
    walk = (X[i+1]-X[i])*a
    score += min(walk, telepo)
print(score)

Submission status: Accepted

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

costs = [(x[i+1] - x[i]) * A for i in range(0, N-1)]
print(sum([min(ci, B) for ci in costs]))

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

Submission status: Accepted

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

start=X[0]
cost=0
for i in range(len(X)):
    goto=X[i]
    if((goto-start)*A>B):
        cost+=B
    else:
        cost+=(goto-start)*A
    start=goto

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

print(Ans)

Submission status: Accepted

Solution code:
n,a,b=map(int, input().split())
x=list(map(int, input().split()))
count=0
for i in range(1,n):
    if (x[i]-x[i-1])*a < b :count+=(x[i]-x[i-1])*a
    else: count+=b
    #print(x[i],count,(x[i]-x[i-1])*a)
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(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())
a = list(map(int,input().split()))
ans = 0
for i in range(1,N):
  if (a[i] - a[i-1])*A < B:
    ans += (a[i] - a[i-1])*A
  else:
    ans += B
print(ans)

Submission status: Accepted

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

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:
n, a, b = map(int, input().split())
l = list(map(int, input().split()))
ans = 0

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split(' '))
x_list = list(map(int, input().split(' ')))
ex = 0
for i in range(1, len(x_list)):
    if (x_list[i] - x_list[i-1]) * A >= B:
        ex += B
    else:
        ex += (x_list[i] - x_list[i-1]) * A
print(ex)

Submission status: Accepted

Solution code:
n, a, b = list(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()))
ans = sum([min(A * (X[i+1]-X[i]), B) for i in range(N-1)])
print(ans)

Submission status: Accepted

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

cost = 0
px = x[0]
for i in range(1, len(x)):
    w_cost = (x[i] - px) * a
    if w_cost > b:
        cost += b
    else:
        cost += w_cost
    px = x[i]

print(cost)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,A,B=map(int,raw_input().split())
X=map(int,raw_input().split())
cost={}
for i in range(N-1):
		cost[(i,i+1)]=min(B, (X[i+1]-X[i])*A)

print sum( cost.values() )

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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 = 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:
l = map(int, raw_input().split())
points = map(int, raw_input().split())
cor = 0
for i in range(1,len(points)):
    if ((points[i]-points[i-1])*l[1]) > l[2]:
        cor+=l[2]
    elif ( (points[i]-points[i-1])*l[1])< l[2]:
        cor+=(points[i]-points[i-1])*l[1]

print cor

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict


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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n,a,b = map(int, raw_input().split())
x = map(int, raw_input().split())
y = [0]*(n-1)
ans = 0

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