Harryxun/stf_run huggingface dataset:
n,m=[int(i) for i in input().split(' ')]
class P:
  def __init__(self, a, b)
  	self.a = a
    self.b = b

p = []
for i in range(n):
  a,b=[int(i) for i in input().split(' ')]
  p.append(P(a, b))

  
mon = 0
p.sort(key=lambda x: x.a)
for e in p:
  if m <= e.b:
    mon += e.q * m
    m = 0
  else:
    m -= e.b
    mon += e.a * e.b

print(mon)

### FIXED CODE ###

n,m=[int(i) for i in input().split(' ')]
class P:
  def __init__(self, a, b):
    self.a = a
    self.b = b

p = []
for i in range(n):
  a,b=[int(i) for i in input().split(' ')]
  p.append(P(a, b))

  
mon = 0
p.sort(key=lambda x: x.a)
for e in p:
  if m <= e.b:
    mon += e.a * m
    m = 0
  else:
    m -= e.b
    mon += e.a * e.b

print(mon)
O = raw_input()
E = raw_input()
out = O+E
out[::2] = E
out[1::2] = O

### FIXED CODE ###

O = raw_input()
E = raw_input()
out = O+E
out =  list(out)
for count in range(0,len(out)/2):
	out[2*count] = O[count]
	out[2*count+1] = E[count]
if len(O) > len(E):
	out[2*count+2] = O[count+1]
out = ''.join(out)
print out
from bisect import bisect_left, bisect_right
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
A = inpl()
C = [[] for _ in range(K)]
m = 0
C[0].append(-1)
for i in range(N):
    m = (m + A[i] - 1) % K
    C[m].append(i)

ans = 0
for k in range(K):
    L = len(C[k])
    if L <= 1:
        continue
    l = r = 0
    while r < L:
        r = bisect_left(C[k], C[k][l]+K-1, l)
        if r == L:
            ans += (L-l)*(L-l-1)//2
        else:
            ans += r - l - 1
            if C[k][r] == C[k][l]+K-1:
                ans += 1
            l += 1
print(ans)


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import defaultdict
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, K = inpl()
A = inpl()
if K == 1:
    print(0)
    exit()
C = defaultdict(list)
k_list = set()
m = 0
C[0].append(-1)
for i in range(N):
    m = (m + A[i] - 1) % K
    C[m].append(i)
    k_list.add(m)

ans = 0
for k in k_list:
    L = len(C[k])
    if L <= 1:
        continue
    l = r = 0
    while r < L:
        r = bisect_left(C[k], C[k][l]+K-1, l)
        if r == L:
            ans += (L-l)*(L-l-1)//2
        else:
            ans += r - l - 1
            if C[k][r] == C[k][l]+K-1:
                ans += 1
            l += 1
print(ans)
import math
while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

    z=a*e-b*d
    if z==0:
        break

    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    print(round(x,3) round(y,3))
    

### FIXED CODE ###

while True:
    try:
        line=input()

    except:
        break

    a,b,c,d,e,f=map(int, line.strip().split())

   
    
    y=(c*d-f*a)/(b*d-a*e)
    x=(c*e-f*b)/(a*e-b*d)

    if x<=0 and x>=-0.0005:
        x=0.000
    
    if y<=0 and y>=-0.0005:
        y=0.000
        
    print('{:.3f} {:.3f}'.format(x,y))
n=int(input())
listh=(list(map(int,input().split()))
count=1
for i in range(2,n+1):
  max=max(list[:i-1])
  if listh[i-1]>=max:
    count+=1
print(count)


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
cnt=1
for i in range(1,n):
  if h[i]>=max(h[:i]):
    cnt+=1
print(cnt)
def calc_distance(maze):
    sx,sy,gx,gy = 0,0,w-1,h-1
    #maze = maze.split()
    INF = 10000000000
    field_x_length = w
    field_y_length = h
        
    distance = []
    for i in range(field_y_length):
        distance.append([])
        for j in range(field_x_length):
            distance[i].append(INF)
        
    queue = []
    queue.insert(0, (sy,sx))
    distance[sy][sx] = 0
        
    while True:
        y, x = queue.pop()
        if(x == gx and y == gy):
            break
                
        for i in range(0,4):
            nx, ny = x +[1,0,-1,0][i], y +[0,1,0,-1][i]
                
            if(0 <= nx and nx < field_x_length and 0 <= ny and ny < field_y_length and maze[ny][nx] != '#' and distance[ny][nx] == INF):
                queue.insert(0,(ny, nx))
                distance[ny][nx] = distance[y][x] + 1
    return distance[gy][gx]
    
h,w = map(int, input().split())
maze = [input() for _ in range(h)]

import collections
count = 0
for i in range(0,h):
    c = collections.Counter(maze[i])
    count += c["#"]


print(w*h - count - calc_distance(maze) -1)

### FIXED CODE ###

def calc_distance(maze):
    sx,sy,gx,gy = 0,0,w-1,h-1
    #maze = maze.split()
    INF = 10000000000
    field_x_length = w
    field_y_length = h
        
    distance = []
    for i in range(field_y_length):
        distance.append([])
        for j in range(field_x_length):
            distance[i].append(INF)
        
    queue = []
    queue.insert(0, (sy,sx))
    distance[sy][sx] = 0
        
    while queue:
        y, x = queue.pop()
        if(x == gx and y == gy):
            break
                
        for i in range(0,4):
            nx, ny = x +[1,0,-1,0][i], y +[0,1,0,-1][i]
                
            if(0 <= nx and nx < field_x_length and 0 <= ny and ny < field_y_length and maze[ny][nx] != '#' and distance[ny][nx] == INF):
                queue.insert(0,(ny, nx))
                distance[ny][nx] = distance[y][x] + 1
    return distance[gy][gx]
    
h,w = map(int, input().split())
maze = [input() for _ in range(h)]

import collections
count = 0
for i in range(0,h):
    c = collections.Counter(maze[i])
    count += c["#"]

if (calc_distance(maze) < 200):
    print(w*h - count - calc_distance(maze) -1)
else:
    print(-1)
n = int(input())
b = list(map(int, input().split()))
ans = b[0] + b[-1]
for i in range n-2:
    ans += min(b[i], b[i+1])
print(ans)


### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
ans = b[0] + b[-1]
for i in range(n-2):
    ans += min(b[i], b[i+1])
print(ans)
def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]

    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]
    for root in range(n):
        if len(g[root]) > 2:
            break
    else:
        if n % 2:
            print("First")
        else:
            print("Second")
        return

    d = [-1]*n  # 根からの距離
    d[root] = 0
    q = [root]
    cnt = 0
    while q:  # BFS
        cnt += 1
        qq = []
        while q:
            i = q.pop()
            for j in g[i]:
                if d[j] == -1:
                    d[j] = cnt
                    qq.append(j)
        q = qq
    d2 = sorted([(j, i) for i, j in enumerate(d)])[::-1]
    end = [False]*n
    dp = [[] for _ in [0]*n]
    for _, i in d2:
        if len(g[i]) > 2:
            continue
        elif len(g[i]) == 1:
            dp[g[i][0]].append(1)
            if len(dp[g[i][0]]) > 1:
                end[g[i][0]] = True
        elif not end[i] and dp[i]:
            dist = dp[i][0]
            for j in g[i]:
                if d[j] < d[i]:
                    dp[j].append(dist+1)
    dp = [[j % 2 for j in i] for i in dp]
    one = set()
    for j, i in enumerate(dp):
        if i.count(1) > 1:
            print("First")
            return
        elif i.count(1) == 1:
            one.add(j)
    for i in one:
        q = [i]
        visited = {i}
        cnt = 1
        while q:
            qq = []
            j = q.pop()
            for k in g[j]:
                if k in visited:
                    continue
                visited.add(k)
                if len(g[k]) > 2:
                    if cnt % 2 == 0:
                        if k in one:
                            print(1/0)
                            print("First")
                            return
                elif len(g[k]) == 2:
                    qq.append(k)
            cnt += 1
            q = qq
    print("Second")


main()


### FIXED CODE ###

def main():
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
    g = [set() for _ in [0]*n]
    [g[a-1].add(b-1) for a, b in ab]
    [g[b-1].add(a-1) for a, b in ab]
    only = []
    sign = [False]*n
    for i in range(n):
        if len(g[i]) == 1:
            only.append(i)
    while only:
        i = only.pop()
        if not g[i]:
            print("Second")
            return
        j = g[i].pop()
        g[j].remove(i)
        if sign[i] and not g[j]:
            print("First")
            return
        if not sign[i] and sign[j]:
            print("First")
            return
        if not sign[j] and not sign[i]:
            sign[j] = True
        if len(g[j]) == 1:
            only.append(j)


main()
a, b, c = input().split(" ")
print("{} {} {}".format(c, a, b)

### FIXED CODE ###

a, b, c = map(int, input().split(" "))
print(c, a, b)
X, N = map(int, input().split())
p_list = set([int(i) for i in input().split()])
set_all = set(np.arange(-100, 101))
ex_list = set_all-p_list
ex_list = list(ex_list)
diff_list = [np.abs(i-X) for i in ex_list]
min_index = np.argmin(diff_list)
print(ex_list[min_index])

### FIXED CODE ###

import numpy as np
X, N = map(int, input().split())
p_list = set([int(i) for i in input().split()])
set_all = set(np.arange(-201, 201))
ex_list = set_all-p_list
ex_list = list(ex_list)
diff_list = [np.abs(i-X) for i in ex_list]
min_index = np.argmin(diff_list)
print(ex_list[min_index])
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

MOD = 10**9+7

def main():
    A,B=[int(x) for x in input().split()]

    max_gcd=gcd([A,B])
    P=primes(max_gcd)
    ans=1 # 1
    for p in P:
        if A%p==0 and B%p==0:
            ans+=1
    print(ans)

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

main()

### FIXED CODE ###

from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
import logging
import heapq
logging.basicConfig(level=logging.DEBUG)

input = sys.stdin.readline

setrecursionlimit(1000000)

MOD = 10**9+7

def main():
    A,B=[int(x) for x in input().split()]

    max_gcd=gcd([A,B])
    P=prime_factor(max_gcd)
    P2=set(P)
    print(len(P2)+1)

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass #sortされていない

def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

main()
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
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

 
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-------------------------------------------
    k = int(input())
    ans = 0
    l = [i for i in range(1,k+1)]
    p_list = list(itertools.combinations_with_replacement(l,3))
    for i in p_list:
        ans += gcd(gcd(i[0],i[1]),i[2])*(6//math.factorial((4-len(set(i)))))
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

### FIXED CODE ###

from math import gcd
def main(): #startline-------------------------------------------
    k = int(input())
    ans = 0
    for i in range(1,k+1):
        for j in range(1,k+1):
            for l in range(1,k+1):
                ans += gcd(gcd(i,j),l)

    print(ans)
if __name__ == "__main__":
    main() #endline===============================================
N = int(input())
count = [0 for i in range(N)]
n = []
for _ in range(N-1):
  a, b = map(int, input().split())
  count[a-1] += 1
  count[b-1] += 1
  n.append([a, b])

K = max(count)
All = set([j for j in range(1, K+1)])
memo = [[] for i in range(N)]
print(K)
for i in range(N-1):
  a, b = n[i]
  m = list(All - set(memo[a-1] + memo[b-1]))[0]
  memo[a-1].append(m)
  memo[b-1].append(m)
  print(m)


### FIXED CODE ###

from collections import deque

N = int(input())

G = [[] for _ in range(N)]
for i in range(N-1):
  a, b = map(int, input().split())
  G[a-1].append([b-1, i])
  G[b-1].append([a-1, i])


q = deque()
q.append([0, 0, 0])

colors = [0] * (N-1)
while q:
  node, parent, edge_color = q.popleft()
  c = 1
  for child, index in G[node]:
    if child == parent:
      continue
    
    if c == edge_color:
      c += 1
    
    q.append([child, node, c])
    colors[index] = c
    c += 1

print(max(colors))
print(*colors, sep='\n')
import itertools
import bisect
n = int(input())
#a=sorted(list(map(int, input().split())))
b=sorted(list(map(int, input().split())))
c=sorted(list(map(int, input().split())))
cnt=0

for i in range(0,len(c)):
    b_index=bisect.bisect_left(b,c[-i-1])
    for u in range(b_index):
        cnt+=bisect.bisect_left(a,b[b_index-1-u])
    
print(cnt)

### FIXED CODE ###

import itertools
import bisect
n = int(input())
a=sorted(list(map(int, input().split())))
b=sorted(list(map(int, input().split())))
c=sorted(list(map(int, input().split())))
cnt=0

for i in range(0,len(b)):
    a_index = bisect.bisect_left(a,b[i])
    c_index = bisect.bisect_right(c,b[i])
    cnt+=a_index*(len(c)-c_index)
    
print(cnt)
import fractions

def main():
    A, B = list(map(int, input().split()))
    print(lcm(A, B))

def lcm(a, b):
    return a * b // fractions.lcm(a, b)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import fractions

def main():
    A, B = list(map(int, input().split()))
    print(lcm(A, B))

def lcm(a, b):
    return a * b // fractions.gcd(a, b)

if __name__ == "__main__":
    main()
N = int(input()) 

ans='' 

while N>0:
	N -= 1
	ans += chr(ord('a') + N % 26) 
    N //= 26
    
print(ans[::-1])

### FIXED CODE ###

N = int(input()) 

ans='' 

while N>0:
	N -= 1
	ans += chr(ord('a') + N % 26) 
	N = N//26
    
print(ans[::-1])
N = int(input())
lis = list(map(int,input().split()))
x = 0
lis.sort()
for i in range(0,N+1):
        if lis[i] == lis[i+1]:
                x = 1
                break
if x == 0:
        print("YES")
else:
        print("NO")

### FIXED CODE ###

N = int(input())
lis = list(map(int,input().split()))
lis.sort()
judge = 0
for i in range(1,N):
    if lis[i-1] == lis[i]:
        judge = 1
if judge == 0:
    print("YES")
else:
    print("NO")
A, B, C = int(input().split())

int ans = max(A*10 + B + C, B*10 + A + C, C*10 + A + B)
print(ans)

### FIXED CODE ###

A, B, C = map(int, input().split())


ans = max(A*10 + B + C, B*10 + A + C, C*10 + A + B)
print(ans)
N = int(input())
arr = list(map(int, input().split()))

ans = arr[0]+arr[N-1]
for i in range(1,N-1,1):
   ans += min(arr[i],arr[i-1])
   
print(ans)


### FIXED CODE ###

import sys
import math

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

def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def rinput():
    return map(int, tinput())

def rlinput():
    return list(rinput())

def pro(k, l, n):
    if l < n:
        if k == 0:
            return(n - l)
        return (n - l + 2)
    if l == n:
        if k == 0:
            return 0
        elif k == 1:
            return 1
        return 3
    else:
        l -= n - 1
        if l == k:
            return 1
        elif l > k:
            return 0
        if l < k - 1:
            return 2
        else:
            return 3
            

def rt(k, l , n):
    if k < n:
        if l == 0:
            return (k * 2 + n)
        return (n + k * 2 - 1)
    elif k == n:
        if l == 1:
            return (k * 3 - 2)
        elif l == 0:
            return (k * 3)
        return (k * 3 - 3)
    else:
        k -= n - 1
        if k == l:
            return (n * 3 - 2)
        elif k > l:
            return (n * 3)
        if k < l - 1:
            return ((n - 1) * 3 - 1)
        else:
            return ((n - 1) * 3)



def main():
    n = iinput()
    a = rlinput()
    res = a[0] + a[-1]
    for i in range(n - 2):
        if a[i] > a[i + 1]:
            res += a[i + 1]
        else:
            res += a[i]
    print(res)
    
    
    
    
    


main()
N=int(input())
v=list(map(int,input().split())).sort()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v[0].pop()
print(v[0])

### FIXED CODE ###

N=int(input())
v=list(map(int,input().split()))
v.sort()
for a in range(N-1):
  v[1]=(v[0]+v[1])/2
  v.pop(0)
print(v[0])
n=int(input())
dat = list(map(int, input().split()))

boolean flag=True
int count = 0

while flag:
     for i in range(n):
         if dat[i]%2==1:
             flag=False
              break
          else:
              dat[i] = dat[i]/2
       count = count+1

print(count)
         


 
      
      
             


    
    
     
                

         
           




### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
a,b = map(int, input().split)
if (a*b)%2 = 0:
	print('Even')
Else:
    print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
c = (a*b)%2
if c ==0:
  print('Even')
else:
  print('Odd')
# -*- coding: utf-8 -*-
a, b = input().split()
b_arr = b.split('.')
print(int(a)*(int(b_arr[0])+*int(b_arr[1])//100))

### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = input().split()
print(int(a)*int(b.replace('.', ''))//100)
n,k=map(int,input().split())
s=list(map(int,str(input())))
if s[0]==1:
  one_st=[0]+[i+1 for i in range(n-1) if s[i]==0 and s[i+1]==1]
  zero_st=[i+1 for i in range(n-1) if s[i]==1 and s[i+1]==0]
else:
  one_st=[i+1 for i in range(n-1) if s[i]==0 and s[i+1]==1]
  zero_st=[0]+[i+1 for i in range(n-1) if s[i]==1 and s[i+1]==0]
if s[n-1]==1:
  one_en=[i for i in range(n-1) if s[i]==1 and s[i+1]==0]+[n-1]
  zero_en=[i for i in range(n-1) if s[i]==0 and s[i+1]==1]
else:
  one_en=[i for i in range(n-1) if s[i]==1 and s[i+1]==0]
  zero_en=[i for i in range(n-1) if s[i]==0 and s[i+1]==1]+[n-1]
if len(zero_st) <= k:
  x=n
else:
  y=[one_en[i+k]-one_st[i]+1 for i in range(len(zero_st)-k+1) if i+k+1<=len(one_en)]
  y=y+[one_en[k-1]+1,n-one_st[len(zero_st)-k]]
  x=max(y)
print(x)

### FIXED CODE ###

n,k=map(int,input().split())
s=list(map(int,str(input())))
if s[0]==1:
  one_st=[0]+[i+1 for i in range(n-1) if s[i]==0 and s[i+1]==1]
  zero_st=[i+1 for i in range(n-1) if s[i]==1 and s[i+1]==0]
else:
  one_st=[i+1 for i in range(n-1) if s[i]==0 and s[i+1]==1]
  zero_st=[0]+[i+1 for i in range(n-1) if s[i]==1 and s[i+1]==0]
if s[n-1]==1:
  one_en=[i for i in range(n-1) if s[i]==1 and s[i+1]==0]+[n-1]
  zero_en=[i for i in range(n-1) if s[i]==0 and s[i+1]==1]
else:
  one_en=[i for i in range(n-1) if s[i]==1 and s[i+1]==0]
  zero_en=[i for i in range(n-1) if s[i]==0 and s[i+1]==1]+[n-1]
if len(zero_st) <= k:
  x=n
else:
  y=[one_en[i+k]-one_st[i]+1 for i in range(len(zero_st)-k+1) if i+k+1<=len(one_en)]
  y=y+[one_en[k-1]+1,n-one_st[len(one_st)-k]]
  x=max(y)
print(x)
# -*- coding: utf-8 -*-
a, b, k = map(int, input().split())
if a > b:
    t = a
    a = b
    b = t
# 0<a<b<100
fact = []
for i in range(1,a+1,):
    if a%i==0 and b%i==0:
        count = count + 1
        fact.append(i)
print(fact[-k])

### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b, k = map(int, input().split())
if a > b:
    t = a
    a = b
    b = t
# 0<a<b<100
fact = []
for i in range(1,a+1,):
    if a%i==0 and b%i==0:
        fact.append(i)
print(fact[-k])
str_list = []
n_number,l_length = map(int,input().split())
w_1=input()
str_list.append(w_1)
w_2=input()
str_list.append(w_2)
w_3=input()
str_list.append(w_3)


str_list.sort()
print(''.join(str_list))

### FIXED CODE ###

str_list = []
i = 1
n_number, l_length = map(int, input().split())
while i <= n_number:
    w_1 = input()
    str_list.append(w_1)
    i += 1


str_list.sort()
print(''.join(str_list))
a=int(input()), b=int(input())

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")

### FIXED CODE ###

a,b=map(int, input().split())

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")
s = input()
print(s[0] + (len(s) - 2) + s[-1])

### FIXED CODE ###

s = input()
print(s[0] + str(len(s) - 2) + s[-1])
a,b,c=map(int,input().split())
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

If A==B and B1==C:
    print(“YES”)
else:
    print(“NO”)

### FIXED CODE ###

a,b,c=input().split()
A=a[len(a)-1]
B=b[0]
B1=b[len(b)-1]
C=c[0]

if A==B and B1==C:
    print("YES")
else:
    print("NO")
n,x,m=map(int,input().split())
a=list()
ans=0
s=n
for i in range(n):
    ans+=x
    a.append(x)
    x=(x**2)%m
    if x in a:
        s=a.index(x)
        break

sum=0
if s!=n:
    for i in range(s, len(a)):
        sum+=a[i]

ans+=sum*(((n-s)//(len(a)-s))-1)

z=(n-s)%(len(a)-s)
for i in range(z):
    ans+=a[s+i]
print(ans)


### FIXED CODE ###

n,x,m=map(int,input().split())
a=list()
ans=0
s=n
for i in range(n):
    ans+=x
    a.append(x)
    x=(x**2)%m
    if x in a:
        s=a.index(x)
        break

sum=0
if s!=n:
    for i in range(s, len(a)):
        sum+=a[i]   

if len(a)>s:
    ans+=sum*(((n-s)//(len(a)-s))-1)

    z=(n-s)%(len(a)-s)
    if z!=0:
        for i in range(z):
            ans+=a[s+i]
print(ans)
N=int(input())
S=input()
T=input()
ans=S+T

while ans[-N:]==T:
    recover=ans
    if ans[N-1]==ans[N]:
        ans=ans[:N]+ans[N+1:]
    else:
        recover=ans
        break

if S in T:
    print(len(T))
elif T in S:
    print(len(S))
else:
    print(len(recover))

### FIXED CODE ###

N=int(input())
S=input()
T=input()

ans=2*N
i=N
while i:
    if S[-i:]==T[:i]:
        ans-=i
        break
    i-=1

print(ans)
input = list(input())
print(*input[::-2], *input[::2]

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])
S = str(input())
if S == 'ABC'
	print('ARC')
else
	print('ABC')

### FIXED CODE ###

S = str(input())
if S == 'ABC':
	print('ARC')
else:
	print('ABC')