Harryxun/stf_run huggingface dataset:
length = input().split()
a = length[0]
b = length[1]
area = a*b
per = 2*a+2*b
print(a," ",b)


### FIXED CODE ###

length0 = input()
#print(length0)
length = length0.split()
a = int(length[0])
b = int(length[1])
#print(str(a)+" "+str(b))
area = a*b
per = 2*a+2*b
print(str(area)+" "+str(per))
def main():
    _ = int(input())
    A = list(map(int, input().split()))
    c = [False] * (4800 // 400 - 1)
    d = [0] * (4800 // 400 - 1)
    for a in A:
        c[a // 400] = True
        d[a // 400] += 1
    mn = 1 if c[:8].count(True) == 0 else c[:8].count(True)
    mx = c[:8].count(True) + sum(d[8:])
    print(mn, mx)


main()


### FIXED CODE ###

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    c = [False] * (4800 // 400 + 1)
    d = [0] * (4800 // 400 + 1)
    for a in A:
        c[a // 400] = True
        d[a // 400] += 1
    mn = 1 if c[:8].count(True) == 0 else c[:8].count(True)
    mx = c[:8].count(True) + sum(d[8:])
    print(mn, mx)


main()
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10
print(ans)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

l = [a,b,c,d,e]
if len([i for i in l if i != 0]) == 0:
    m = 10
    
else:
    m = min([i for i in l if i != 0])
n = l.count(0)
ans = (A//10 + B//10 + C//10 + D//10 + E//10)*10 + m + (5-n)*10 -10
print(ans)
N=int(input())
A=list(map(int, input().split()))
B=A
M=max(A)
k=0
Fumi=0

for k in range(1,N):
    if A[k-1]>A[k]:
        Fumi=Fumi+A[k-1]-A[k]
        A[k]=A[k-1]
    k=k+1

print(Fumi)

### FIXED CODE ###

N, X, T = input().strip().split()
N, X, T = [int(N), int(X), int(T)]

q=N // X
mod = N % X

if mod != 0:
 q = q + 1

time = T*q

print(time)
import collections
n = int(input())
que = collections.deque()
for _ in range(n):
    command = input()
    if 'insert' in command:
        command, num = command.split()
        que.appendleft(int(num))
    elif 'deleteFirst' in command:
        que.popleft()
    elif 'deleteLast' in command:
        que.pop()
    elif 'delete' in command:
        command, num = command.split()
        que.remove(int(num))
print(' '.join(map(str, que)))

### FIXED CODE ###

import sys
import collections
n = int(input())
que = collections.deque()

for _ in range(n):
    command = sys.stdin.readline()
    if 'i' == command[0]:
        command, num = command.split()
        que.appendleft(num)
    elif 'deleteFirst\n' == command:
        que.popleft()
    elif 'deleteLast\n' == command:
        que.pop()
    else:
        command, num = command.split()
        try:
            que.remove(num)
        except ValueError:
            pass
print(' '.join(map(str, que)))
S = input()
chars = []
for i in range(len(S)):
    chars.append(S[i])
if chars.count(chars[0]) == 2:
    for i in range(1, len(S) + 1):
        if chars[i] == 2:
            print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
chars = []
for i in range(len(S)):
    chars.append(S[i])
if chars.count(chars[0]) == 2:
    for i in range(len(S)):
        if chars.count(chars[i]) != 2:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")
if S[0] == S[1] and S[1] == S[2]:
  print("NO")
else:
  print("YES")

### FIXED CODE ###

S = input()
if len(set(S)) != 2:
  print("No")
else:
  print("Yes")
import numpy as np  

n, w = map(int, input().split()) 

dp = np.array([0] * w+1)

for i in range(n):
    weight, value = map(int, input().split())

    dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value) 

print(dp[-1])

### FIXED CODE ###

import sys
import numpy as np
import itertools
import heapq
import bisect
import math
import queue
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数
from copy import deepcopy #参照で影響されないコピー
from collections import Counter, deque, defaultdict #要素ごとの出現回数、双方向アクセス可能データ型
from functools import reduce
mod = 1000000007
inf = 10**10
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

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


def main():
    n, w = map(int, input().split())
    wv = [list(map(int, input().split())) for _ in range(n)]

    dp = np.zeros([n+1, w+1])
    
    for i, itm in enumerate(wv):
        dp[i+1, :itm[0]] = dp[i, :itm[0]]
        dp[i+1, itm[0]:] = np.max([dp[i, itm[0]:], dp[i, :w-itm[0]+1] + itm[1]], axis=0)

    print(int(dp[n, w]))


if __name__ == "__main__":
    main()
# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(input_str_list, int))
    return input_int_list

X = get_stdin_int_list()[0]
n_500 = int(X / 500)
X = X % 500
n_5 = int(X/5)

p = n_500*1000 + n_5*5
print(p)

### FIXED CODE ###

# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(int, input_str_list))
    return input_int_list

X = get_stdin_int_list()[0]
n_500 = int(X / 500)
X = X % 500
n_5 = int(X/5)

p = n_500*1000 + n_5*5
print(p)
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)

def stairs(x):
    if x > 2:
        return stairs(x-1) + stairs(x-2)
    elif x == 2:
        return 2
    elif x == 1 or x == 0:
        return 1

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    for k in range(len(salst)):
        ans *= stairs(salst[k])

    print(ans%1000000007)


### FIXED CODE ###

n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)
memo = [0] * 100001
def stairs(x):
    memo[0] = 1
    memo[1] = 1
    for i in range(2, x+1):
        memo[i] = memo[i-2] + memo[i-1]

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    maxnum = max(salst)
    stairs(maxnum)
    for l in salst:
        ans *= memo[l]
    print(ans%1000000007)
h,w=map(int,input().split())
s=['#'*(w+2)]+['#'+input()+'#' for _ in [0]*h]+['#'*(w+2)]
l=[[0]*(w+2) for _ in [0]*(h+2)]
for i in range(h+2):
    for j in range(w+2):
        if s[i][j]=='#':
            l[i][j]=-1
def sol(m,n):
    global l
    if l[m][n]>=0:
        for [i,j] in [[m-1,n],[m+1,n],[m,n-1],[m,n+1]]:
            if l[i][j]==0 and [i,j]!=[1,1]:
                l[i][j]=l[m][n]+1
                sol(i,j)
            elif l[i][j]>l[m][n]+1:
                l[i][j]=l[m][n]+1
                sol(i,j)
sol(1,1)
if l[h][w]==0:print(-1)
else:print(h*w-l[h][w]-(sum(x.count('#') for x in s)-2*h-2*w-4)-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(3000)
h,w=map(int,input().split())
s=['#'*(w+2)]+['#'+input()+'#' for _ in [0]*h]+['#'*(w+2)]
l=[[0]*(w+2) for _ in [0]*(h+2)]
for i in range(h+2):
    for j in range(w+2):
        if s[i][j]=='#':
            l[i][j]=-1
def sol(m,n):
    global l
    if l[m][n]>=0:
        for i,j in [(m-1,n),(m+1,n),(m,n-1),(m,n+1)]:
            if l[i][j]==0 and [i,j]!=[1,1]:
                l[i][j]=l[m][n]+1
                sol(i,j)
            elif l[i][j]>l[m][n]+1:
                l[i][j]=l[m][n]+1
                sol(i,j)
sol(1,1)
if l[h][w]==0:print(-1)
else:print(h*w-l[h][w]-(sum(x.count('#') for x in s)-2*h-2*w-4)-1)
pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)


### FIXED CODE ###

pat = ["A", "C", "G", "T"]

s = input()

left = right = 0
ans = 0

while left < len(s):
    right = left
    while right < len(s) and s[right] in pat:
        right += 1

    ans = max(ans, right - left)

    left = right + 1

print(ans)
n,k,s = map(int, input().split())

ans = [1] * n
ans[0] = s
if k % 2 == 0:
    i = 1
    while k > 1:
        ans[i], ans[i+1] = 1, s-1
        i += 2
        k -= 1
else:
    for i in range(1,k+1):
        ans[i] = s//2
print(" ".join(map(str, ans)))

### FIXED CODE ###

n,k,s = map(int, input().split())
if s < 10 ** 9:
    ans = [s+1] * n
else:
    ans = [1] * n
ans[:k] = [s] * k
print(" ".join(map(str, ans)))
N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())
  
max_s=max(s)
ans=-1

for j in range(1000):
  flag=True
  k=str(j)  
  if len(k)<max_s:
    pass
  else:
    if len(k)!=N:
      pass
    else:    
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        if ans==-1:
          ans=j
        else:
          ans=min(ans,j)
        break
      
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
s=[0]*M
c=[0]*M

for i in range(M):
  s[i],c[i]= map(int,input().split())

if M==0:
  for j in range(1000):
    k=str(j)
    if len(k)==N:
      ans=j
      break
else:
  max_s=max(s)
  ans=-1
  for j in range(1000):
    flag=True
    k=str(j)
    if len(k)!=N:
      pass
    else:
      for l in range(M):
        if int(k[s[l]-1])!=c[l]:
          flag=False
          break
      if flag==True:
        ans=j
        break
      
print(ans)
n=int(input())
a=list(map(int, input().split()))

a.sort()
if a[0]==a[1]:
    flag=True
else:
    flag=False
for i in range(n-1):
    if a[i]==0:
        continue
    else:
        for j in range(i+1,n):
            # print(a[j],a[i])
            if a[j]%a[i]==0:
                a[j]=0
            # print(a)

print(n-a.count(0)-1 if flag else n-a.count(0))



### FIXED CODE ###

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

from collections import Counter
c=Counter(a)

max_a=max(a)
bls=[0]*(max_a+1)
for a_i in a:
    for j in range(a_i, max_a+1, a_i):
        bls[j]+=1
ans=0
for a_i in a:
    if bls[a_i]==1 and c[a_i]==1:
        ans+=1
print(ans)
ab=[]

n,m = map(int,input().split())

for i in range(m):
    ab=(map(int,input().split()))


abr=[]
enabled=[]
removed=[]
for i in range(m):
    abr.append(range(ab[i][0],ab[i][1]))
    enabled.append(False)
    removed.append(False)

res=0
for i in range(n):
    for j in range(len(abr)):
        if i == abr[j][0] and not removed[j]:
            enabled[j]=True
    for j in range(len(abr)):
        if i == abr[j][-1] and enabled[j]:
            res+=1
            for k in range(len(abr)):
                if enabled[k] and not removed[k]:
                    enabled[k]=False
                    removed[k]=True

print(res)

### FIXED CODE ###

ab=[]

n,m = map(int,input().split())

for i in range(m):
    ab.append(tuple(map(int,input().split())))

ab.sort(key=lambda x:x[1])

res=0
for z in range(len(ab)):
    x=ab[0][1]
    for j in range(len(ab)):
        if x > ab[0][0]:
            del ab[0]
        else:
            res+=1
            break
    if len(ab)==0:
        res+=1
        break
    
print(res)
import sys
import defaultdict

args = sys.argv
dd = defaultdict(int)

for arg in args:
    dd[arg] += 1

if dd[5] == 2 and dd[7] == 1:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

from collections import defaultdict

dd = defaultdict(int)
for i in input().split():
    dd[i] += 1

if dd['5'] == 2 and dd['7'] == 1:
    print('YES')
else:
    print('NO')
import sys
n=input()
a=input()
b=input()
train=n*a
taxi=b
if train>=taxi:
  print(train)
else:
  print(taxi)

### FIXED CODE ###

import sys

n,a,b=(int(x) for x in input().split())

train=n*a
taxi=b
if train>=taxi:
  print(taxi)
else:
  print(train)
import fractions
a,b,c,d = map(int,input().split())
cd = c*d//fractions.gcd(c,d)
e = a-1
f = (b//c + b//d - b//(cd)) - (e//c + e//d - e//(cd))
print(b-e-f)

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    l += [list(map(int,input().split()))]
l = sorted(l,key=lambda x:x[1])
t = 0
for i in range(n):
    t += l[i][0]
    if t > l[i][1]:
        print('No')
        exit()
print('Yes')
n=int(input())
arr=list(map(int,input().split()))
vis={}
vis[0] = 0
if n < 2:
  print(0)
  exit
if n == 2:
  print(min(arr[0]-arr[1]))
  exit
vis[1] = min(arr[0]-arr[1])
def count(n):
    if n < 0:
      return 0
    if n in vis:
        return vis[n]
    else:
      vis[n]=min(abs(arr[n-1]-arr[n-2])+count(n-1),abs(arr[n-1]-arr[n-3])+count(n-2))
    return vis[n]
print(count(n))

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis = [0] * n
vis[0] = 0
vis[1] = abs(arr[0]-arr[1])
for i in range(2, n):
    step_1 = abs(arr[i]-arr[i-1]) + vis[i-1]
    step_2 = abs(arr[i]-arr[i-2]) + vis[i-2]
    vis[i] = min(step_1, step_2)
print(vis[-1])
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    if diff < d10-d:
      diff = d10-d
      last= index
  else:
    ans.append(d)


ans.remove(ans[last])

print(sum(ans)+dish[last])

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
last = 0
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10)+1) *10
    if last <= d10 - d:
      last = d10 - d
    dish[index] = d10
print(sum(dish)-last)
a, b, x = map(int, input().split())
fb = b // x
if a == 0:
    fa = 0
else:
    fa = (a-1) // x
print(fb-fa)


### FIXED CODE ###

n = input().split()
b = []
for i in n:
    b.append(i[0])
b = ','.join(b)
b = b.replace(',','')
print(b)
N = int(input())
Bin = list(map(int, input().split()))

B = []
Btmp = [Bin[0]]
for i in range(1, N):
  if Bin[i] == 1:
    B.append(Btmp)
    Btmp = []
  Btmp.append(Bin[i])
else:
  B.append(Btmp)
#print(B)
#print(list(reversed(B)))

def solve(arr):
  ret = []
  while len(arr) > 0:
    before = len(arr)
    for i in reversed(range(len(arr))):
      if arr[i] == i + 1:
        ret.append(arr.pop(i))
        break
    if len(arr) == before:
      return None
  return reversed(ret)

A = []
for Bsub in reversed(B):
  a = solve(Bsub)
  A.extend(a)
#print(A)
for a in A:
  print(a)

### FIXED CODE ###

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

def solve(arr):
  ret = []
  while len(arr) > 0:
    before = len(arr)
    for i in reversed(range(len(arr))):
      if arr[i] == i + 1:
        ret.append(arr.pop(i))
        break
    if len(arr) == before:
      return None
  return list(reversed(ret))

A = solve(B)
#print(A)

if A == None:
  print(-1)
else:
  for a in A:
    print(a)
"""
ABC112C Diff:
"""
import sys
from itertools import product
input = sys.stdin.readline
xyh = []
xyh0 = []
N=int(input())
for _ in range(N):
    tmp1, tmp2, tmp3 = map(int, input().split())
    if tmp3 > 0:
        xyh.append((tmp1, tmp2, tmp3))
    else:
        xyh0.append((tmp1, tmp2, tmp3))
ans = None
for cx, cy in product(range(101), repeat=2):
    H = None
    H_lower = 1
    is_ok = 1
    for x, y, h in xyh:
        if H is None:
            H = abs(x-cx)+abs(y-cy)+h
        else:
            if H != abs(x-cx)+abs(y-cy)+h:
                is_ok = 0
                break
    if not is_ok:
        continue
    for x, y, h in xyh0:
        H_lower = max(H_lower, abs(x-cx)+abs(y-cy))
    if H < H_lower:
        continue
    ans = (cx, cy, H)
    break
        
print(*ans)

### FIXED CODE ###

from itertools import product
xyh = []
xyh0 = []
N=int(input())
for _ in range(N):
    tmp1, tmp2, tmp3 = map(int, input().split())
    if tmp3 > 0:
        xyh.append((tmp1, tmp2, tmp3))
    else:
        xyh0.append((tmp1, tmp2, tmp3))
ans = None
for cx, cy in product(range(101), repeat=2):
    H = None
    H_lower = 1
    H_upper = 10**100
    is_ok = 1
    for x, y, h in xyh:
        if H is None:
            H = abs(x-cx)+abs(y-cy)+h
        else:
            if H != abs(x-cx)+abs(y-cy)+h:
                is_ok = 0
                break
    if not is_ok or H is None:
        continue
    for x, y, h in xyh0:
        H_upper = min(H_upper, abs(x-cx)+abs(y-cy))
    if H > H_upper or H < H_lower:
        continue
    ans = (cx, cy, H)
    break

print(*ans)
s = input()
ls = len(s)

t = 'keyence'
idx = 0

for i in range(ls):
    if s[i] == t[idx]:
        idx += 1

if idx == len(t):
    print('YES')
else:
    print('NO')


### FIXED CODE ###

import re

s = input()
t = 'keyence'

for i in range(len(t)):
    ptn = '^' + t[:i] + '.*' + t[i:] + '$'
    # print(ptn)
    m = re.match(ptn, s)
    if m: break

if m:
    print('YES')
else:
    print('NO')
a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)

### FIXED CODE ###

a = list(map(int,input().split()))
A = a[0]
B = a[1]
K = a[2]
A1 = A - K
B1 = B
if A1 < 0:
    B1 = A1 + B
    A1 = 0
    if B1 < 0:
        B1 = 0

print(A1,end=" ")
print(B1)
import random
list = []
for i in range(31):
  list.append(random.randint(0,100))
K = int(input())
print(list[K-1])


### FIXED CODE ###

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(list[K-1])
N = input()
t = N[0]
if N == t + "9"(len(N)-1):
  print(int(t)+9*(len(N)-1))
else:
  print(int(t)-1+9*(len(N)-1))

### FIXED CODE ###

N = input()
t = N[0]
if N == t + "9"*(len(N)-1):
  print(int(t)+9*(len(N)-1))
else:
  print(int(t)-1+9*(len(N)-1))
# coding: utf-8
# Your code here!
eng_li = []
removed_list = []
all_letter = 26
for i in range (97,97+all_letter):
    eng_li.append(chr(i))

string = list(raw_input().strip())
length = len(string)
if length < all_letter:
    for i in string:
        eng_li.remove(i)
    string.append(eng_li[0])
    answer = "".join(string)
else:
    for i in range(all_letter-1):
        if ord(string[-1]) < ord(string[-2]) :
            removed_list.append(string[-1])
            string.pop()
        else:
            removed_list.append(string[-1])
            string.pop()
            removed_list=filter(lambda x:x>string[-1],sorted(removed_list))
            string.pop()
            string.append(removed_list[0])
            answer ="".join(string)
            break
    else:
        answer = -1
print answer

### FIXED CODE ###

# coding: utf-8
# Your code here!
eng_li = []
removed_list = []
all_letter = 26
for i in range (97,97+all_letter):
    eng_li.append(chr(i))
 
string = list(raw_input().strip())
length = len(string)
if length < all_letter:
    for i in string:
        eng_li.remove(i)
    string.append(eng_li[0])
    answer = "".join(string)
else:
    for i in range(all_letter-1):
        if ord(string[-1]) < ord(string[-2]) :
            removed_list.append(string[-1])
            string.pop()
        else:
            removed_list.append(string[-1])
            string.pop()
            removed_list=filter(lambda x:x>string[-1],sorted(removed_list))
            string.pop()
            string.append(removed_list[0])
            answer ="".join(string)
            break
    else:
        answer = -1
print answer
import random

D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
L = [0 for i in range(26)]
T = [int(input()) for i in range(D)]

def calc(T):
  score=0
  for d in range(D):
    score += S[d][T[d]-1]

    L[T[d]-1] = d+1
    down = 0
    for i in range(26):
      down+=C[i] * ((d+1) - L[i])

    score -=down
  return score

max_score=0
bestT=[]

for i in range(10):
  T = [random.randrange(1,26) for i in range(D)] 
  score = calc(T)
  if score > max_score:
    bestT = T
    max_score = score

for t in T:
  print(t)

### FIXED CODE ###

import random

D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]


def calc(T):
  L = [0 for i in range(26)]
  score=0
  for d in range(D):
    score += S[d][T[d]-1]

    L[T[d]-1] = d+1
    down = 0
    for i in range(26):
      down+=C[i] * ((d+1) - L[i])

    score -=down
  return score

max_score=0
bestT=[]

for i in range(10):
  T = [random.randrange(1,26) for i in range(D)] 
  score = calc(T)

  if score > max_score:
    bestT = T
    max_score = score

for t in T:
  print(t)
mod = 10 ** 9 + 7
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())

for i in range(1, k + 1):
    print(int(cmb(n - k + 1, i) * cmb(k - 1, i - 1)) % mod)

### FIXED CODE ###

mod = 10 ** 9 + 7
from operator import mul
from functools import reduce

def modcomb(n, k):
    x, y = 1, 1
    for i in range(k):
        x = x * (n - i) % mod
        y = y * (k - i) % mod
    return x * pow(y, mod - 2, mod) % mod

n, k = map(int, input().split())

for i in range(1, k + 1):
    #入れる場所
    print(int(modcomb(n - k + 1, i) * modcomb(k - 1, i - 1)) % mod)
    #分け方
fl = input()
sl = input()

koma_num, pos_num = [int (x) for x in fl.split(" ")]
poses = [int(x) for x in sl.split(" ")]
poses.sort()

dists = []
total = 0
for n in range(pos_num-1):
    dists.append(abs(poses[n+1] - poses[n]))
    total += poses[n+1] - poses[n]

dists.sort()
dists.reverse()

for n in range(koma_num-1):
    total -= dists[n]

print(total)


### FIXED CODE ###

fl = input()
sl = input()

koma_num, pos_num = [int (x) for x in fl.split(" ")]
poses = [int(x) for x in sl.split(" ")]
poses.sort()

if koma_num >= pos_num:
    print("0")
    exit()

dists = []
total = 0
for n in range(pos_num-1):
    dist = poses[n+1] - poses[n]
    dists.append(dist)
    total += dist

dists.sort()
dists.reverse()

if(len(dists) == 0):
    print("0")
    exit()

for n in range(koma_num-1):
    total -= dists[n]

print(total)
from fractions import math
(A, B) = list(map(int, input().split()))
print((A * B) // gcd(A, B))

### FIXED CODE ###

import fractions
(A, B) = list(map(int, input().split()))
print((A * B) // fractions.gcd(A, B))
n,m = map(int,input().split())
x = list(map(int,input().split()))

if n >= m:
    print(0)
else:
    x = sorted(x)
    x = [x[i+1]-x[i] for i in range(len(x)-1)]

    x = sorted(x, reverse=True)
    x = xx[n-1:]
    ans = 0
    for i in x:
        ans+=i
    print(ans)


### FIXED CODE ###

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

if n >= m:
    print(0)
else:
    x = sorted(x)
    xx = [x[i+1]-x[i] for i in range(len(x)-1)]

    xx = sorted(xx, reverse=True)
    xx = xx[n-1:]
    ans = 0
    for i in xx:
        ans+=i
    print(ans)