a,b=input().split()

e=[str(a*int(b)),str(b*int(a))]

e.sort()

print((e[0]))

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

print((str(a[0])*a[1]))
a, b = input().split()
e = [str(a * int(b)), str(b * int(a))]
e.sort()
print((e[0]))

a = sorted(list(map(int, input().split())))
print((str(a[0]) * a[1]))

-a, b = input().split() -e = [str(a * int(b)), str(b * int(a))] -e.sort() -print((e[0])) +a = sorted(list(map(int, input().split()))) +print((str(a[0]) * a[1]))