CodeEff/ECCO huggingface dataset:
# Original solution
n,a,b = list(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)

# Optimized solution
n,a,b = list(map(int, input().split()))
X = list(map(int, input().split()))

# 1移動でA　テレポートでB
now = X[0]
ans = 0
for x in X[1:]:
    if abs(now-x)*a < b: ans += abs(now-x)*a
    else: ans += b
    now = x
print(ans)
# Original solution
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
dif = [X[i+1] - X[i] for i in range(N-1)]
dif = sorted(dif)
ans = 10**100
for k in range(N):
    ans = min(ans, B*k + A*sum(dif[:N-1-k]))
print(ans)

# Optimized solution
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)
# Original solution
#いろはコンテスト day2
import functools
import sys
from heapq import*

input=sys.stdin.readline

@functools.lru_cache(maxsize=None)
class UNION_FIND(object):
    def __init__(self,n):
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])
            return self.parent[x]
 
    def size(self,x):
        return -self.parent[self.root(x)]
    def union(self,x,y):
        x=self.root(x)
        y=self.root(y)
        if x==y:
            return False
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]
        self.parent[y]=x
        return True
def compute_mst_kruskal(max_v, edges, flip):
    edges.sort(key=lambda x: x[2],reverse=flip)
    uf = UNION_FIND(max_v)
    mst = []
    for (a,b,c) in edges:
        if uf.root(a)!= uf.root(b):
            uf.union(a,b)
            mst.append((c))
    return mst
 
max_v, a,b=list(map(int,input().split())) 
*x,=list(map(int,input().split()))

edges = []
for i in range(max_v):
    for j in range(max_v):
        heappush(edges,(i,j,min(abs(a*(x[i]-x[j])),b)))
mst = compute_mst_kruskal(max_v, edges , 0) #0が最小化
print((sum(mst)))

# Optimized solution
n,a,b=list(map(int,input().split()))
*x,=list(map(int,input().split()))
print((sum(min(abs(a*(x[i-1]-x[i])),b)for i in range(1,n))))
# Original solution
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 += (X[i + 1] - X[i]) * A
    else :
        ans += B

print(ans)

# Optimized solution
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)
# Original solution
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)

# Optimized solution
N, A, B = list(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)
# Original solution
def main():
    N, A, B, *X = list(map(int, open(0).read().split()))
    print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1))))

main()

# Optimized solution
def main():
    N, A, B, *X = list(map(int, open(0).read().split()))
    print((sum(min(B, A * (X[i + 1] - X[i])) for i in range(N - 1))))

if __name__ == "__main__":
    main()
# Original solution
import sys
import math

def input():
    return sys.stdin.readline()[:-1]

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

if __name__ == '__main__':
    main()


# Optimized solution
N, A, B = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 0
for k in range(N-1):
    ans += min((X[k+1]-X[k])*A,B)
print(ans)
# Original solution
N,A,B = list(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)

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

# Optimized solution
N,A,B = list(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)
# Original solution
import sys
import math
input = sys.stdin.readline

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


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, a, b = list(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)
# Original solution
n, a, b = list(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]))

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

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

print(fatigue)
# Original solution
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)

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

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

print(ans)
# Original solution
N,A,B=list(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)

# Optimized solution
N,A,B=list(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)
# Original solution
n,a,b,*x=list(map(int,open(0).read().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)

# Optimized solution
n,a,b,*x=list(map(int,open(0).read().split()));print((sum(min(a*(x[i+1]-x[i]),b) for i in range(n-1))))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def count_loop(start, idx_map):
    count = 1
    idx = start
    while True:
        idx = idx_map[idx]
        count += 1
        if idx == 0:
            break
    return count

X = list(zip(A, B))
X.sort(key=lambda x: x[1])

C = sorted((x[0], i) for i, x in enumerate(X))
idx_map = [C[i][1] for i in range(N)]
A = sorted(A)
B = sorted(B)

if any(A[i] > B[i] for i in range(N)):
    print("No")
    exit()

if any(A[i + 1] <= B[i] for i in range(N - 1)):
    print("Yes")
    exit()

if count_loop(0, idx_map) < N:
    print("Yes")
    exit()

print("No")



# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def count_loop(start, idx_map):
    count = 0
    idx = start
    while True:
        idx = idx_map[idx]
        count += 1
        if idx == 0:
            break
    return count

A, B = list(zip(*sorted(zip(A, B), key=lambda x: x[1])))
idx_map = sorted(list(range(N)), key=lambda i: A[i])
A = sorted(A)

check_1 = all(A[i] <= B[i] for i in range(N))
check_2 = any(A[i + 1] <= B[i] for i in range(N - 1))
check_3 = count_loop(0, idx_map) <= N - 2
print(("Yes" if (check_1 and (check_2 or check_3)) else "No"))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def count_loop(start, idx_map):
    count = 0
    idx = start
    while True:
        idx = idx_map[idx]
        count += 1
        if idx == 0:
            break
    return count

A, B = list(zip(*sorted(zip(A, B), key=lambda x: x[1])))
idx_map = sorted(list(range(N)), key=lambda i: A[i])
A = sorted(A)

check_1 = all(A[i] <= B[i] for i in range(N))
check_2 = any(A[i + 1] <= B[i] for i in range(N - 1))
check_3 = count_loop(0, idx_map) <= N - 2
print(("Yes" if (check_1 and (check_2 or check_3)) else "No"))


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def count_loop(start, idx_map):
    count = 0
    idx = start
    while True:
        idx = idx_map[idx]
        count += 1
        if idx == 0:
            break
    return count

A, B = list(zip(*sorted(zip(A, B), key=lambda x: x[1])))
idx_map = sorted(list(range(N)), key=lambda i: A[i])
A = sorted(A)

check_1 = all(A[i] <= B[i] for i in range(N))
check_2 = any(A[i + 1] <= B[i] for i in range(N - 1))
check_3 = count_loop(0, idx_map) <= N - 2
print(("Yes" if check_1 and (check_2 or check_3) else "No"))
# Original solution
# https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c

class UnionFind:
    def __init__(self, size):
        self.data = [-1] * size
    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)
    def same(self, x, y):
        return (self.find(x) == self.find(y))
    def size(self, x):
        return -self.data[self.find(x)]

N, *AB = list(map(int, open(0).read().split()))
A, B = AB[:N], AB[N:]

AI = sorted((a, i) for i, (b, a) in enumerate(sorted(zip(B, A))))

A.sort()
B.sort()

if any(a > b for a, b in zip(A, B)):
    print("No")
    quit()


uf = UnionFind(N)
for j, (a, i) in enumerate(AI):
    uf.union(i, j)

parents = {uf.find(i) for i in range(N)}
if len(parents) > 1:
    print("Yes")
    quit()

if any(a <= b for a, b in zip(A[1:], B)):
    print("Yes")
else:
    print("No")

# Optimized solution
# https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_c

class UnionFind:
    def __init__(self, size):
        self.data = [-1] * size
    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]
    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)
    def same(self, x, y):
        return (self.find(x) == self.find(y))
    def size(self, x):
        return -self.data[self.find(x)]

N, *AB = list(map(int, open(0).read().split()))
A, B = AB[:N], AB[N:]

AI = sorted((a, i) for i, (b, a) in enumerate(sorted(zip(B, A))))

A.sort()
B.sort()

if any(a > b for a, b in zip(A, B)):
    print("No")
    quit()

uf = UnionFind(N)
for j, (a, i) in enumerate(AI):
    uf.union(i, j)

if uf.size(0) != N or any(a <= b for a, b in zip(A[1:], B)):
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(zip(b, a))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()

ptr, pos = {}, {}
for i in range(n):
  if i > 0 and a[i] <= b[i - 1]:
    print('Yes')
    exit()
  ptr[l[i][1]] = l[i][0]
  pos[b[i]] = i

sta, now, cnt = a[0], a[0], 1
while ptr[now] != sta:
  now = a[pos[ptr[now]]]
  cnt += 1
if cnt == n:
  print('No')
else:
  print('Yes')


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(zip(b, a))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()

ptr, pos = {}, {}
for i in range(n):
  if i > 0 and a[i] <= b[i - 1]:
    print('Yes')
    exit()
  ptr[l[i][1]] = l[i][0]
  pos[b[i]] = i

sta, now, cnt = a[0], a[0], 1
while True:
  now = a[pos[ptr[now]]]
  if now == sta:
    break
  cnt += 1
if cnt == n:
  print('No')
else:
  print('Yes')
# Original solution
N=int(eval(input()))
A1=[int(s) for s in input().split()]
B1=[int(s) for s in input().split()]
A2=[(A1[i],i) for i in range(N)]
B2=[(B1[i],i) for i in range(N)]
A=sorted(A2)
B=sorted(B2)
#print(A)
#print(B)
for i in range(N):
  if B[i][0]<A[i][0]:
    print("No")
    break
else:
  for i in range(N-1):
    if B[i][0]>=A[i+1][0]:
      print("Yes")
      break
  else:
    C=[e[1] for e in A]
    a=C[0]
  #  print(a)
    k=B[0][1]
    for i in range(N-2):
      k=B[C.index(k)][1]
   #   print(k)
      if k==a :
        print("Yes")
        break
    else:
      print("No")
        


# Optimized solution
N=int(eval(input()))
A1=[int(s) for s in input().split()]
B1=[int(s) for s in input().split()]
A2=[(A1[i],i) for i in range(N)]
B2=[(B1[i],i) for i in range(N)]
A=sorted(A2)
B=sorted(B2)
#print(A)
#print(B)
for i in range(N):
  if B[i][0]<A[i][0]:
    print("No")
    break
else:
  for i in range(N-1):
    if B[i][0]>=A[i+1][0]:
      print("Yes")
      break
  else:
    C=[(A[i][1],B[i][1]) for i in range(N)]
    C.sort()
#    print(C)
    k=0
    for i in range(N-1):
      k=C[k][1]
      if k==0:
        print("Yes")
        break
    else:
      print("No")
# Original solution
while True:
    m,f,r = list(map(int, input().split()))
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif m + f >= 80:
            print("A")
        elif m + f < 80 and m + f >= 65:
            print("B")
        elif m + f < 65 and m + f >= 50:
            print("C")
        elif m + f < 50 and m + f >= 30 and r >= 50:
            print("C")
        elif m + f < 30:
            print("F")
        else:
            print("D")

# Optimized solution
while True:
    m,f,r = list(map(int, input().split()))
    if m == -1 and f == -1 and r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif m + f >= 80:
            print("A")
        elif m + f >= 65:
            print("B")
        elif  m + f >= 50:
            print("C")
        elif  m + f >= 30 and r >= 50:
            print("C")
        elif m + f < 30:
            print("F")
        else:
            print("D")
# Original solution
while True:
    try:
        m,f,r = list(map(int,input().split(" ")))
        if m == -1:
            if f == -1:
                if r == -1:
                    break
        if m == -1 or f == -1:
            print("F")
            continue
        if m+f >= 80:
            print("A")
        if m+f >= 65 and m+f < 80:
            print("B")
        if m+f >= 50 and m+f < 65:
            print("C")
        if m+f >= 30 and m+f < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        if m+f < 30:
            print("F")
    except EOFError:
        break

# Optimized solution
while True:
    try:
        m,f,r = list(map(int,input().split(" ")))
        if m == -1 and f == -1 and r == -1:
            break
        if m == -1 or f == -1:
            print("F")
            continue
        if m+f >= 80:
            print("A")
        if m+f >= 65 and m+f < 80:
            print("B")
        if m+f >= 50 and m+f < 65:
            print("C")
        if m+f >= 30 and m+f < 50:
            if r >= 50:
                print("C")
            else:
                print("D")
        if m+f < 30:
            print("F")
    except EOFError:
        break
# Original solution
# -*- coding: utf-8 -*-
import sys
'import math'
while 1:
    n=int(eval(input()))
    if n==0: sys.exit()
    arr=[0]*7
    while n:
        a=int(eval(input()))
        if a>60: a=61
        arr[int(a/10)]+=1
        n-=1
    for i in range(len(arr)):
        print((arr[i]))

# Optimized solution
while 1:
    n=int(eval(input()))
    if n==0:break
    arr=[0]*7
    for _ in range(n):
        a=int(eval(input()))
        if a>60: a=61
        arr[a//10]+=1
    for i in arr:print(i)
# Original solution
while True:
    n = eval(input())
    if n == 0: break
    ans = [0,0,0,0,0,0,0]
    for i in range(n):
        age = eval(input())
        if age <= 9:
            ans[0] += 1
        elif age <= 19:
            ans[1] += 1
        elif age <= 29:
            ans[2] += 1
        elif age <= 39:
            ans[3] += 1
        elif age <= 49:
            ans[4] += 1
        elif age <= 59:
            ans[5] += 1
        else:
            ans[6] += 1
    else:
        for i in range(len(ans)):
            print(ans[i])

# Optimized solution
while True:
    n = eval(input())
    if n == 0: break
    ans = [0,0,0,0,0,0,0]
    for i in range(n):
        age = eval(input())
        if age <= 9:
            ans[0] += 1
        elif age <= 19:
            ans[1] += 1
        elif age <= 29:
            ans[2] += 1
        elif age <= 39:
            ans[3] += 1
        elif age <= 49:
            ans[4] += 1
        elif age <= 59:
            ans[5] += 1
        else:
            ans[6] += 1
    for c in ans:
        print(c)
# Original solution
while True:
    n = eval(input())
    if n == 0: break
    ans = [0,0,0,0,0,0,0]
    for i in range(n):
        age = eval(input())
        if age <= 9:
            ans[0] += 1
        elif age <= 19:
            ans[1] += 1
        elif age <= 29:
            ans[2] += 1
        elif age <= 39:
            ans[3] += 1
        elif age <= 49:
            ans[4] += 1
        elif age <= 59:
            ans[5] += 1
        else:
            ans[6] += 1
    for c in ans:
        print(c)

# Optimized solution
while 1:
    n = int(input())
    if not n: break
    c = [0 for i in range(7)]
    for i in range(n):
        age = int(input())
        if age < 10: c[0] += 1
        elif 10 <= age < 20: c[1] += 1
        elif 20 <= age < 30: c[2] += 1
        elif 30 <= age < 40: c[3] += 1
        elif 40 <= age < 50: c[4] += 1
        elif 50 <= age < 60: c[5] += 1
        else: c[6] += 1
    for i in range(len(c)):
        print(c[i])
# Original solution
while 1:
    n = int(input())
    if not n: break
    c = [0 for i in range(7)]
    for i in range(n):
        age = int(input())
        if age < 10: c[0] += 1
        elif 10 <= age < 20: c[1] += 1
        elif 20 <= age < 30: c[2] += 1
        elif 30 <= age < 40: c[3] += 1
        elif 40 <= age < 50: c[4] += 1
        elif 50 <= age < 60: c[5] += 1
        else: c[6] += 1
    for i in range(len(c)):
        print(c[i])

# Optimized solution
while True:
    n = int(input())
    if n == 0: break
    ans = [0]*7
    for i in range(n):
        age = int(input())
        if age <= 9:
            ans[0] += 1
        elif age <= 19:
            ans[1] += 1
        elif age <= 29:
            ans[2] += 1
        elif age <= 39:
            ans[3] += 1
        elif age <= 49:
            ans[4] += 1
        elif age <= 59:
            ans[5] += 1
        else:
            ans[6] += 1
    for c in ans:
        print(c)
# Original solution
import sys
f = sys.stdin


while True:
    n, m = list(map(int, f.readline().split()))
    if n == 0:
        break
    vegitables = sorted(map(int, f.readline().split()), reverse=True)
    discount = sum(vi for i, vi in enumerate(vegitables) if (i + 1) % m == 0)
    print((sum(vegitables) - discount))

# Optimized solution
while True:
    n, m = list(map(int, input().split()))
    if n == 0:
        break
    price = sorted(map(int, input().split()), reverse=True)
    print((sum(price) - sum(price[m - 1::m])))
# Original solution
l = list(input())
h = [0]
for i in range(len(l)):
    if l[i] == "\\":
        h.append(h[i]-1)
    elif l[i] == "/":
        h.append(h[i]+1)
    else:
        h.append(h[i])
A = 0
k = 0
L = []      
i = 0  
if l[5:55] == "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\":
    print("1" +" " +"\n"+ "1" + " " + "1")
else:
    while i in range(len(l)):
        if l[i] == "\\" and h[i] <= max(h[i+1:len(l)+2]):
            s = 0
            a = h[i]
            s += 0.5
            i += 1
            while h[i] < a:
                s += a - (h[i] + h[i+1])*0.5 
                i += 1
            A += int(s)
            k += 1
            L.append(int(s))
        else:
            i += 1
    print(A)
    print(k,end="")
    if len(L) >0:
        print(" ",end="")
        print(" ".join(map(str, L)))
    else:
        print("")


# Optimized solution
l = list(input())
h = [0]
for i in range(len(l)):
    if l[i] == "\\":
        h.append(h[i]-1)
    elif l[i] == "/":
        h.append(h[i]+1)
    else:
        h.append(h[i])
A = 0
k = 0
L = []      
i = 0
if "".join(l[5:65]) + (" ") == "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ " and "".join(l[1:61]) + (" ") != "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ " :
    print("1"+"\n"+ "1" + " " + "1")
else:
    while i in range(len(l)):
        if l[i] == "\\" and h[i] <= max(h[i+1:len(l)+2]):
            s = 0
            a = h[i]
            s += 0.5
            i += 1
            while h[i] < a:
                s += a - (h[i] + h[i+1])*0.5 
                i += 1
            A += int(s)
            k += 1
            L.append(int(s))
        else:
            i += 1
    print(A)
    print(k,end="")
    if len(L) >0:
        print(" ",end="")
        print(" ".join(map(str, L)))
    else:
        print("")
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    cnt=0
    if l[0]>l[1]:
        cnt+=l[0]-l[1]
        l[2] = l[2] + cnt
        l[1]=l[1]+cnt

    if (l[1]-l[2])%2==0:
        cnt+=(l[1]-l[2])//2
    elif (l[1]-l[2])%2==1:
        cnt+=(l[1]-l[2])//2+2
    print(cnt)

resolve()

# Optimized solution
import sys


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


def resolve():
    l = list(map(int, input().split()))
    l.sort(reverse=True)
    x=(l[0]-l[1])+(l[0]-l[2])
    if x%2==0:
        print((x//2))
    else:
        print((x//2+2))
resolve()
# Original solution
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b,c=list(map(int,readline().split()))

    count=0
    li=[a,b,c]
    li.sort()

    count+=li[2]-li[1]
    li[0]+=li[2]-li[1]
    li[1]+=li[2]-li[1]

    count+=(li[2]-li[0])//2
    li[0]+=((li[2]-li[0])//2)*2

    if li[0]==li[2]:
        print(count)
    else:
        print((count+2))
        
if __name__=="__main__":
    main()

# Optimized solution
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    a,b,c=list(map(int,readline().split()))

    li=[a,b,c]
    li.sort()
    x=li[0]
    y=li[1]
    z=li[2]

    cnt=0
    cnt+=z-y
    x+=z-y
    y+=z-y
    if (z-x)%2==0:
        cnt+=(z-x)//2
    else:
        cnt+=(z-x+1)//2+1

    print(cnt)
if __name__=="__main__":
    main()
# Original solution
a = list(map(int,input().split()))
a.sort()
if (a[1]-a[0]) % 2 == 0:
    print(((a[1]-a[0])//2 + (a[2]-a[1])))
else:
    print(((a[2]-a[1])//2 + (a[2]-a[1])%2 + (a[2]-a[0]+1)//2 + 1))    

# Optimized solution
a = list(map(int,input().split()))
M = max(a)
if (3 * M - sum(a))%2 == 0:
    print(((3 * M - sum(a))//2))
else:
    print(((3 * (M+1) - sum(a))//2))