Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopolis. Thus Leha was left completely alone in a quiet town Vičkopolis. He almost even fell into a depression from boredom!

Leha came up with a task for himself to relax a little. He chooses two integers A and B and then calculates the greatest common divisor of integers "A factorial" and "B factorial". Formally the hacker wants to find out GCD(A!, B!). It's well known that the factorial of an integer x is a product of all positive integers less than or equal to x. Thus x! = 1·2·3·...·(x - 1)·x. For example 4! = 1·2·3·4 = 24. Recall that GCD(x, y) is the largest positive integer q that divides (without a remainder) both x and y.

Leha has learned how to solve this task very effective. You are able to cope with it not worse, aren't you?


-----Input-----

The first and single line contains two integers A and B (1 ≤ A, B ≤ 10^9, min(A, B) ≤ 12).


-----Output-----

Print a single integer denoting the greatest common divisor of integers A! and B!.


-----Example-----
Input
4 3

Output
6



-----Note-----

Consider the sample.

4! = 1·2·3·4 = 24. 3! = 1·2·3 = 6. The greatest common divisor of integers 24 and 6 is exactly 6.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Number theory

Implementation


Solutions:
import math
a = map(int, input().split())
print(math.factorial(min(a)))


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

def fact(x):
	if x == 1:
		return 1
	return fact(x - 1) * x
print(fact(min(a, b)))


import math
li = list(map(int, input().split()))
print(math.factorial(min(li)))


from math import factorial
lis = list(map(int, input().split()))
k = min(lis)
print(factorial(k))


import math
(a, b) = [int(x) for x in input().split()]
d = min(a, b)
print(math.factorial(d))


n = min(map(int, input().split()))
ans = 1
for i in range(1, n + 1):
	ans *= i
print(ans)


import math
(x, y) = [int(i) for i in input().split()]
print(math.factorial(min(x, y)))


import math

def solution():
	n = input().split()
	m = min(int(n[-1]), int(n[0]))
	print(math.factorial(m))
solution()


import math
(n, m) = map(int, input().split())
a = min(n, m)
print(math.factorial(a))


import math
(a, b) = (int(i) for i in input().split())
k = min(a, b)
print(math.factorial(k))


(a, b) = map(int, input().split())
A = []
A.append(1)
if b < a:
	(b, a) = (a, b)
if a > 1:
	for i in range(1, a):
		A.append(A[i - 1] * (i + 1))
	print(A[i])
else:
	print(1)


f = lambda x: x * f(x - 1) if x else 1
print(f(min(map(int, input().split()))))


def fact(n):
	m = 1
	for i in range(1, n + 1):
		m *= i
	return m
print(fact(min(list(map(int, input().split())))))


def answer():
	a = input().split()
	a = [int(x) for x in a]
	bottom = min(a)
	out = 1
	cook = 1
	while cook <= bottom:
		out *= cook
		cook += 1
	return out
print(answer())


s = 1
(a, b) = map(int, input().split())
for i in range(2, min(a, b) + 1):
	s *= i
print(s)


import math
(a, b) = map(int, input().split())
x = math.factorial(min(a, b))
print(x)


import math
(x, y) = input().split()
x = int(x)
y = int(y)
print(math.factorial(min(x, y)))


(a, b) = map(int, input().split())
if a < b:
	c = a
else:
	c = b
factorial = 1
if int(c) >= 1:
	for i in range(1, int(c) + 1):
		factorial = factorial * i
print(factorial)


(a, b) = map(int, input().split())
ans = 1
for i in range(min(a, b)):
	ans = ans * (i + 1)
print(ans)


from math import factorial
(a, b) = map(int, input().split())
print(factorial(min(a, b)))


import math

def main():
	(a, b) = [int(x) for x in input().split()]
	k = min(a, b)
	print(math.factorial(k))
main()


import math
(a, b) = [int(s) for s in input().split()]
print(math.factorial(min(a, b)))


fact = [1, 1, 2]
(n1, n2) = [int(x) for x in input().split(' ')]
p = min(n1, n2)
i = 3
while i <= p:
	fact.append(fact[i - 1] * i)
	i += 1
print(fact[p])


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
print(math.factorial(min(get_list())))


def fact(n):
	if n > 0:
		n = n * fact(n - 1)
		return n
	else:
		return 1
x = input().split()
a = int(x[0])
b = int(x[1])
if a > b:
	z = fact(b)
else:
	z = fact(a)
print(z)


def fact(n):
	if n == 0 or n == 1:
		return 1
	return n * fact(n - 1)
(a, b) = map(int, input().split())
print(fact(min(a, b)))


import math
arr = sorted(list(map(int, input().split())))
print(math.factorial(arr[0]))


(a, b) = map(int, input().split())
k = 1
if b > a:
	(a, b) = (b, a)
for i in range(1, b + 1):
	k *= i
print(k)


def factorial(n):
	out = 1
	for i in range(2, n + 1):
		out *= i
	return out
(a, b) = [int(i) for i in input().split()]
if a > b:
	print(factorial(b))
else:
	print(factorial(a))


(a, b) = [int(n.strip()) for n in input().split(' ')]
fct = a if a <= b else b
temp = 1
for i in range(2, fct + 1):
	temp *= i
print(temp)


import math
(n, c) = map(int, input().split())
w = min(n, c)
print(math.factorial(w))


import math
(a, b) = map(int, input().split())
m = min(a, b)
ans = math.factorial(m)
print(ans)


(a, b) = list(map(int, input().split()))
f = 1
for i in range(1, min(a, b) + 1):
	f *= i
print(f)


import sys

def calFac(n):
	x = 1
	for i in range(1, n + 1):
		x *= i
	return x

def main():
	(a, b) = [int(x) for x in sys.stdin.readline().split()]
	print(calFac(min(a, b)))
main()


import math
(a, b) = map(int, input().split(' '))
if a < b:
	f = math.factorial(a)
elif a > b:
	f = math.factorial(b)
else:
	f = math.factorial(a)
print(f)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def fact(n):
	if n == 1:
		return 1
	else:
		return n * fact(n - 1)
(n, m) = map(int, input().split())
n = min(n, m)
print(fact(n))


from functools import reduce
(a, b) = map(int, str(input()).split())
print(reduce(lambda x, y: x * y, range(1, min(a, b) + 1)))


from sys import stdin
(A, B) = map(int, stdin.readline().split(' '))
if A > B:
	(A, B) = (B, A)
ans = 1
for x in range(1, A + 1):
	ans = ans * x
print(ans)


n = input().split()
a = int(n[0])
b = int(n[1])
count1 = 0
count2 = 0
x1 = 1
x2 = 1
while count1 != a and count2 != b:
	if count1 != a:
		count1 += 1
		x1 *= count1
	if count2 != b:
		count2 += 1
		x2 *= count2
my_list = []
if x1 > x2:
	for i in range(1, x2 + 1):
		if x1 % i == 0:
			my_list.append(i)
elif x1 < x2:
	for i in range(1, x1 + 1):
		if x2 % i == 0:
			my_list.append(i)
else:
	my_list.append(x1)
print(max(my_list))


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

def fact(n):
	f = [0] * (n + 1)
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = i * f[i - 1]
	return f[n]
print(fact(min(a, b)))


(A, B) = map(int, input().split())
fact = 1
for k in range(2, min(A, B) + 1):
	fact = fact * k
print(fact)


I = lambda : map(int, input().split())

def fact(n):
	if n == 1 or n == 0:
		return 1
	return n * fact(n - 1)
(A, B) = I()
print(fact(min(A, B)))


def f(n):
	if n <= 1:
		return 1
	else:
		return n * f(n - 1)
(n, m) = map(int, input().strip().split())
print(f(min(m, n)))


import math
(a, b) = map(int, input().split())
c = min(a, b)
ans = 1
for i in range(1, c + 1):
	ans *= i
print(ans)


import math
import time
s = input().split()
a = int(s[0])
b = int(s[1])

def fact(a):
	n = 1
	for i in range(2, a + 1):
		n = n * i
	print(n)
fact(min(a, b))


import math as m
(A, B) = [int(x) for x in input().split()]
if A <= B:
	print(m.factorial(A))
else:
	print(m.factorial(B))


import math
import os
import random
import re
import sys
a = list(map(int, input().rstrip().split()))
m = min(a)
print(math.factorial(m))


def factorial(n):
	if n == 0:
		return 1
	else:
		return n * factorial(n - 1)
(a, b) = map(int, input().split())
if a < b:
	ans = factorial(a)
else:
	ans = factorial(b)
print(ans)


from math import factorial
(a, b) = input().split(' ')
a = int(a)
b = int(b)
ans = 1
if a < b:
	print(factorial(a))
else:
	print(factorial(b))


import math
string = input()
numbers = string.split(' ')
a = int(numbers[0])
b = int(numbers[1])
print(math.factorial(min([a, b])))


(n, m) = map(int, input().split())
s = 1
m = min(m, n)
while m > 0:
	s = s * m
	m = m - 1
print(s)


import math
l = list(map(int, input().split()))
print(int(math.factorial(min(l[0], l[1]))))


def factorial(n):
	res = 1
	for i in range(2, n + 1):
		res *= i
	return res
print(factorial(min(map(int, input().split()))))


(a, b) = (int(v) for v in input().split())
x = min(a, b)
ans = 1
for i in range(x):
	ans *= i + 1
print(ans)


from math import factorial
print(factorial(min([int(x) for x in input().split()])))


import math
(a, b) = input().split(' ')
fmin = min(int(a), int(b))
res = 1
for i in range(1, fmin + 1):
	res = res * i
print(res)


import math
raw = str(input()).split()
a = int(raw[0])
b = int(raw[1])
if a > b:
	print(math.factorial(b))
else:
	print(math.factorial(a))


import sys
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	q = ain()
	a = q[0]
	b = q[1]
	print(math.factorial(min(a, b)))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def fact(n):
	if n == 1:
		return 1
	return n * fact(n - 1)
(a, b) = [int(i) for i in input().split()]
print(fact(min(a, b)))


import sys

def fact(n):
	if n == 1:
		return 1
	else:
		return n * fact(n - 1)
(x, y) = map(int, sys.stdin.readline().strip().split())
if x < y:
	print(fact(x))
else:
	print(fact(y))


import math

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
tb = [int(i) for i in input().split()]
print(math.factorial(min(tb)))


read = lambda : map(int, input().split())
(a, b) = read()
x = min(a, b)
ans = 1
for i in range(2, x + 1):
	ans *= i
print(ans)


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

def factorial(z):
	if z == 1:
		return 1
	else:
		return z * factorial(z - 1)

def divisor(x, y):
	if x < y:
		factorial(x)
		return factorial(x)
	else:
		factorial(y)
		return factorial(y)
print(divisor(a, b))


def fatorial(num):
	res = 1
	for i in range(num, 0, -1):
		res *= i
	return res
nums = input().split()
num1 = int(nums[0])
num2 = int(nums[1])
if num1 > num2:
	print(fatorial(num2))
else:
	print(fatorial(num1))


from math import factorial
x = input()
a = int(x.split(' ')[0])
b = int(x.split(' ')[1])
print(factorial(min(a, b)))


def factorial(a):
	x = 1
	while a >= 1:
		x *= a
		a -= 1
	return x
(a, b) = tuple(map(int, input().split()))
print(factorial(min(a, b)))


from math import factorial
(A, B) = map(int, input().split())
if A > B:
	print(factorial(B))
else:
	print(factorial(A))


from math import factorial
c = input()
c = c.split()
a = int(c[0])
b = int(c[1])
if a > b:
	print(factorial(b))
else:
	print(factorial(a))


(a, b) = map(int, input().split())
print(eval('*'.join((str(x) for x in range(1, min(a, b) + 1)))))


def fac(n):
	if n == 1:
		return 1
	else:
		return n * fac(n - 1)
(a, b) = [int(x) for x in input().split()]
print(fac(min(a, b)))


s = input().split()
a = int(s[0])
b = int(s[1])
res = 1
m = min(a, b)
for i in range(1, m + 1):
	res *= i
print(res)


def main():
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	x = min(a, b)
	out = 1
	for i in range(2, x + 1):
		out *= i
	print(out)
main()


import math
n = list(map(int, input().split()))
if n[0] < n[1]:
	f1 = math.factorial(n[0])
	print(f1)
	exit()
else:
	f2 = math.factorial(n[1])
	print(f2)
	exit()


(n, m) = list(map(int, input().split()))
a = min(n, m)
ans = 1
for i in range(1, a + 1):
	ans *= i
print(ans)


(a, b) = map(int, input().split(' '))
if a > b:
	(a, b) = (b, a)
ans = 1
for i in range(2, a + 1):
	ans *= i
print(ans)


s = input().split()
n = min(int(s[0]), int(s[1]))
ans = 1
for i in range(1, n + 1):
	ans *= i
print(ans)


from functools import reduce
a = list(map(int, input().split()))
print(reduce(lambda x, y: x * y, range(1, min(a) + 1)))


(a, b) = map(int, input().split())
x = min(a, b)
p = 1
for i in range(1, x + 1):
	p *= i % 1000000007
	p %= 1000000007
print(p)


def fact(n):
	if n == 0:
		return 1
	return n * fact(n - 1)
t = min(map(int, input().split()))
print(fact(t))


from math import factorial
(A, B) = input().split()
(A, B) = (int(A), int(B))
print(factorial(min(A, B)))


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
a = min(q())
x = 1
for i in range(1, a + 1):
	x *= i
print(x)


import math
is_debug = False
(m1, m2) = sorted(map(int, input().split()))
print(f'{math.factorial(m1)}')


import math
input_ar = list(map(int, input().rstrip().split(' ')))
num = min(input_ar[0], input_ar[1])
print(math.factorial(num))


def fact(x):
	if x == 1:
		return 1
	else:
		return x * fact(x - 1)
str = input()
tokens = str.split(' ')
A = int(tokens[0])
B = int(tokens[1])
x = min(A, B)
print(fact(x))


import sys, math
inputs = iter(sys.stdin.readlines())
a = min(map(int, next(inputs).split()))
div = {2, 3, 5, 7, 11}
ans = 1
for x in div:
	p = a
	while p:
		(q, _) = divmod(p, x)
		ans *= pow(x, q)
		p = q
print(ans)


l = [1]
for i in range(1, 13):
	l.append(l[i - 1] * i)
inp = list(map(int, input().split()))
print(l[min(inp)])


def f(a):
	if a <= 1:
		return 1
	return a * f(a - 1)
(a, b) = [int(i) for i in input().split(' ')]
print(f(min(a, b)))


(a, b) = map(int, input().split(' '))
if a > b:
	f = b
else:
	f = a
fact = 1
for i in range(2, f + 1):
	fact *= i
print(fact)


import math
(a, b) = map(int, input().split())
if a > b:
	(a, b) = (b, a)
print(math.factorial(a))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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 LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	a = LI()
	t = min(a)
	return math.factorial(t)
print(main())


from sys import stdin, stdout
import math

def rint():
	return map(int, stdin.readline().split())
(mini, maxi) = rint()
if mini > maxi:
	(mini, maxi) = (maxi, mini)
print(math.factorial(mini))


(n, m) = map(int, input().split())
a = min(n, m)
z = 1
for x in range(1, a + 1):
	z = z * x
print(z)


(a, b) = input().split()
(a, b) = (int(a), int(b))
n = min(a, b)
prod = 1
for i in range(2, n + 1):
	prod = prod * i
print(prod)


def fact(n):
	return 1 if n < 2 else n * fact(n - 1)
(a, b) = map(int, input().split())
print(fact(min(a, b)))


import math
l = list(map(int, input().split()))
if l[0] < l[1]:
	print(math.factorial(l[0]))
else:
	print(math.factorial(l[1]))


import sys
line = sys.stdin.readline()
[x, y] = list(map(int, line.split()))
ans = min(x, y)
for i in range(1, ans):
	ans *= i
print(ans)


(n, m) = map(int, input().split())
kq = 1
if n > m:
	for i in range(2, m + 1, 1):
		kq *= i
else:
	for i in range(2, n + 1, 1):
		kq *= i
print(kq)


from math import factorial
(a, b) = input().split(' ')
if int(a) > int(b):
	mn = int(b)
else:
	mn = int(a)
print(factorial(mn))


from math import *
(x, y) = map(int, input().split())
m = min(x, y)
z = 1
for i in range(1, 1 + m):
	z = z * i
print(z)


import math
(a, b) = map(int, input().strip().split())
c = min(a, b)
print(math.factorial(c))


def MDC(n):
	total = 1
	while n != 0:
		total *= n
		n -= 1
	return total
s = input().split()
a = int(s[0])
b = int(s[1])
if a == 0:
	a = 1
if b == 0:
	b = 1
if a > b:
	print(MDC(b))
else:
	print(MDC(a))


from math import factorial as f, gcd
(m, n) = map(int, input().split())
print(f(min(m, n)))


numbers = list(map(int, input().split()))
smaller_number = numbers[0]
if smaller_number > numbers[1]:
	smaller_number = numbers[1]
count = 1
for i in range(1, smaller_number + 1):
	count = count * i
print(count)


from math import factorial
while True:
	ch = input()
	l = ch.strip().split(' ')
	A = int(l[0])
	B = int(l[1])
	if 1 <= A <= 10 ** 9 and 1 <= B <= 10 ** 9 and (min(A, B) <= 12):
		break
if A >= B:
	print(factorial(B))
else:
	print(factorial(A))


def int_map():
	return map(int, input().split(' '))
(a, b) = int_map()
a = min(a, b)
res = 1
for i in range(1, a + 1):
	res *= i
print(res)


def factorial(x):
	p = 1
	while x != 0:
		p *= x
		x -= 1
	return p
(a, b) = [int(x) for x in input().split()]
print(factorial(min(a, b)))


(x, y) = [int(i) for i in input().split()]
tot = 1
if x <= y:
	for i in range(1, x + 1):
		tot *= i
else:
	for i in range(1, y + 1):
		tot *= i
print(tot)


def max1(a):
	p = a[0]
	for x in a:
		if x > p:
			p = x
	return p

def preobr(x):
	if x % 2 == 1:
		return x + 1
	else:
		return x - 1

def prlist(a):
	for x in a:
		print(x, end=' ')

def dlin(n):
	k = 0
	while n > 0:
		n -= k
		k += 1
	return k - 1

def foundm(x, a):
	for i in range(len(a)):
		if x == a[i]:
			return i
	return -1

def fakt(n):
	p = 1
	for i in range(1, n + 1):
		p *= i
	return p
a = list(map(int, input().split()))
print(fakt(min(a)))


from math import factorial as myfunct
(a, b) = map(int, input().split())
c = min(a, b)
print(myfunct(c))


I = lambda : map(int, input().split())
(a, b) = I()
s = 1
for i in range(1, min(a, b) + 1):
	s *= i
print(s)


def main():
	(x, y) = map(int, input().split())
	ans = 1
	for i in range(1, min(x, y) + 1):
		ans *= i
	print(ans)
main()


(a, b) = input().split(' ')
p = 1
for i in range(2, min(int(a), int(b)) + 1):
	p *= i
print(p)


from math import factorial
a = input().split()
small = min(int(a[0]), int(a[1]))
print(factorial(small))


from math import *
(x, y) = map(int, input().split())
print(factorial(min(x, y)))


t = input().split()
t = [int(x) for x in t]
t = sorted(t)
fac_small = 1
for x in range(1, t[0] + 1):
	fac_small *= x
print(fac_small)


s = input().split()
n1 = int(s[0])
n2 = int(s[1])

def fact(n):
	res = 1
	for i in range(1, n + 1):
		res *= i
	return res
print(fact(min(n1, n2)))


import math
(a, b) = map(int, input().split())
if a <= b:
	m = a
else:
	m = b
print(math.factorial(m))


(n, k) = list(map(int, input().split()))
x = min(n, k)
f = 1
while x > 0:
	f *= x
	x = x - 1
print(f)


def solve():
	(a, b) = get([int])
	a = min(a, b)
	f = 1
	for i in range(1, a + 1):
		f *= i
	print(f)
	return None
import sys
import math
import heapq
import bisect
import itertools
import collections
inf = float('inf')
sys.setrecursionlimit(10000)

def tree():
	return collections.defaultdict(tree)

def cache(func):
	cache_dict = {}

	def _cached_func(*args, _get_cache=False):
		if _get_cache:
			return cache_dict
		if args in cache_dict:
			return cache_dict[args]
		cache_dict[args] = func(*args)
		return cache_dict[args]
	return _cached_func

def equal(x, y, epsilon=1e-06):
	if -epsilon <= x - y <= epsilon:
		return True
	if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
		return False
	return -epsilon <= (x - y) / x <= epsilon or -epsilon <= (x - y) / y <= epsilon

def get(_type):
	if type(_type) == list:
		if len(_type) == 1:
			_type = _type[0]
			return list(map(_type, input().strip().split()))
		else:
			return [_type[i](inp) for (i, inp) in enumerate(input().strip().split())]
	else:
		return _type(input().strip())
solve()


(a, b) = input().split()
(a, b) = (int(a), int(b))
if a <= b:
	m = a
else:
	m = b
x = 1
for i in range(1, m + 1):
	x *= i
print(x)


(a, b) = [int(i) for i in input().split()]
x = min(a, b)
f = 1
for i in range(2, x + 1):
	f = f * i
print(f)


import math
par = [int(i) for i in str(input()).split()]
(x, y) = (par[0], par[1])
print(math.factorial(min(x, y)))


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
ai = lambda : list(map(int, stdin.readline().split()))
ei = lambda : map(int, stdin.readline().split())
ip = lambda : int(stdin.readline().strip())

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
(a, b) = ei()
ans = 1
for i in range(1, min(a, b) + 1):
	ans *= i
print(ans)


import math
(a, b) = input().split()
a = int(a)
b = int(b)
print(math.factorial(min(a, b)))


(A, B) = map(int, input().split())
if A > B:
	A = B
B = 1
for i in range(1, A + 1):
	B *= i
print(B)


def fac(x):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i
	return ans
(n, m) = map(int, input().split())
if n <= m:
	print(fac(n))
else:
	print(fac(m))


def factorial(n):
	res = 1
	for i in range(1, n + 1):
		res = res * i
	return res
(a, b) = map(int, input().split())
print(factorial(min(a, b)))


(a, b) = map(int, input().split())
z = min(a, b)
k = 1
for t in range(1, z + 1):
	k = k * t
print(k)


(a, b) = map(int, input().split())
k = 1
num = 1
if a >= b:
	for i in range(0, b):
		num = num * k
		k += 1
else:
	for j in range(0, a):
		num = num * k
		k += 1
print(num)


import math
(A, B) = map(int, input().split())
a = min(A, B)
print(math.factorial(a))


from math import factorial
n = list(map(int, input().split()))
m = min(n)
print(factorial(m))


def gcd(a):
	f = 1
	for i in range(min(a)):
		f *= min(a) - i
	print(f)
l = list(map(int, input().split()))
gcd(l)


(a, b) = (int(i) for i in input().split())
b = min(a, b)
for i in reversed(range(1, b)):
	b *= i
print(b)


from math import factorial
print(factorial(min(list(map(int, input().split())))))


(a, b) = map(int, input().split())
A = max(a, b)
B = min(a, b)
primes = [2, 3, 5, 7, 11]
cntb = []
cnta = []
a = list()
for num in primes:
	id = primes.index(num)
	cntb.append(0)
	tb = B
	while tb > 0:
		cntb[id] += tb // num
		tb //= num
for num in primes:
	id = primes.index(num)
	cnta.append(0)
	ta = A
	while ta > 0:
		cnta[id] += ta // num
		ta //= num
ret = 1
for num in primes:
	id = primes.index(num)
	ret = ret * pow(num, min(cnta[id], cntb[id]))
print(ret)


import math
tmp = input()
(a, b) = tmp.split(' ')
a = int(a)
b = int(b)
if a < b:
	print(math.factorial(a))
else:
	print(math.factorial(b))


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
(a, b) = rm()
print(math.factorial(min(a, b)))


import sys

def solve(n, i):
	if i == n:
		return i
	else:
		return i * solve(n, i + 1)
(a, b) = [int(x) for x in sys.stdin.readline().strip().split()]
print(solve(min(a, b), 1))


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

def fact(x):
	d = 1
	for i in range(1, x + 1):
		d *= i
	return d
if a[0] > a[1]:
	print(fact(a[1]))
else:
	print(fact(a[0]))


def fact(a):
	b = 1
	for x in range(a):
		b *= x + 1
	return b
(a, b) = input().split(' ')
(a, b) = (int(a), int(b))
if a < b:
	print(fact(a))
else:
	print(fact(b))


(a, b) = map(int, input().split())
f = 1
if a < b:
	for i in range(1, a + 1):
		f *= i
	print(f)
else:
	for r in range(1, b + 1):
		f *= r
	print(f)


import math as m
(a, b) = list(map(int, input().split()))
print(m.factorial(min(a, b)))


input1 = input().split()
in1 = int(input1[0])
in2 = int(input1[1])
res = 1
for i in range(1, min(in1, in2) + 1):
	res *= i
print(res)


import math
arr = input().split()
print(math.factorial(min(int(arr[0]), int(arr[1]))))


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

def fat(x):
	if x == 1 or x == 0:
		return 1
	return x * fat(x - 1)
print(fat(min(a, b)))


def fact(w):
	f = 1
	for i in range(1, w + 1):
		f *= i
	return f
(n, m) = map(int, input().split())
print(fact(min(n, m)))


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

def factorial(n):
	if n == 1:
		return 1
	else:
		return n * factorial(n - 1)
print(factorial(min(a, b)))


def lcm(n):
	prod = 1
	for i in range(2, n + 1):
		prod *= i
	return prod
(a, b) = map(int, input().split())
print(lcm(min(a, b)))


def fact(n):
	sum = 1
	while n > 0:
		sum *= n
		n -= 1
	return sum
(a, b) = map(int, input().split())
print(fact(min(a, b)))


import math

def s():
	(a, b) = [int(x) for x in input().split(' ')]
	mini = min(a, b)
	ans = 1
	for i in range(1, mini + 1):
		ans *= i
	print(ans)
s()


import math
(a, b) = list(map(int, input().split()))
af = math.factorial(min(a, b))
print(af)


import sys

def fact(x):
	result = 1
	for i in range(1, x + 1):
		result = result * i
	return result
a = list(map(int, input().split()))
print(fact(min(a)))


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

def map_input():
	return map(int, input().split())

def map_string():
	return input().split()
from math import factorial
(a, b) = map_input()
print(factorial(min(a, b)))


def f(x):
	m = 1
	for n in range(1, x + 1):
		m *= n
	return m
s = [int(n) for n in input().split()]
g = (s[0] + s[1] - abs(s[0] - s[1])) / 2
print(f(int(g)))


import math
t = min(map(int, input().split()))
print(math.factorial(t))


from math import factorial

def gcd_factorials(n, m):
	return factorial(min(n, m))
(a, b) = [int(j) for j in input().split()]
print(gcd_factorials(a, b))


def factorial(number):
	product = 1
	if number == 0 or number == 1:
		return 1
	while number != 0:
		product *= number
		number -= 1
	return product

def GCD(number1, number2):
	if number1 <= number2:
		return factorial(number1)
	else:
		return factorial(number2)

def main():
	factorial1 = input()
	factorial1 = factorial1.split()
	result = GCD(int(factorial1[0]), int(factorial1[1]))
	print(result)
main()


def factorial(a):
	if a > 1:
		return a * factorial(a - 1)
	else:
		return 1
(x, y) = map(int, input().split())
if x >= y:
	print(factorial(y))
else:
	print(factorial(x))


import math
(n, m) = map(int, input().split())
x = min(n, m)
y = math.factorial(x)
print(y)


def fact(n):
	for i in range(n - 1, 1, -1):
		n *= i
	return n
print(fact(min([int(x) for x in input().split()])))


(n, m) = map(int, input().split())
x = min(n, m)
val = 1
for i in range(1, x + 1):
	val = val * i
print(val)


import math
(m, n) = map(int, input().split())
if m > n:
	print(math.factorial(n))
else:
	print(math.factorial(m))


def fact(n):
	mul = 1
	i = n
	while i > 0:
		mul = mul * i
		i = i - 1
	return mul
(a, b) = map(int, input().split(' '))
print(fact(min(a, b)))


arr = input()
l = list(map(int, arr.split(' ')))
a = min(l)

def factorial(n):
	res = 1
	for i in range(1, n + 1):
		res = res * i
	return res
print(factorial(a))


(m, n) = [int(i) for i in input().split()]
c = min(m, n)
k = 1
for i in range(2, c + 1):
	k *= i
print(k)


from math import factorial as foo
(a, b) = map(int, input().split())
m = min(a, b)
print(foo(m))


def fact(a):
	if a == 0:
		return 1
	else:
		return a * fact(a - 1)
(a, b) = map(int, input().split())
x = fact(a) if a < b else fact(b)
print(x)


(x, y) = [int(i) for i in input().split()]
z = 1
for i in range(1, min(x, y) + 1):
	z *= i
print(z)


def solve(n):
	fact = 1
	for i in range(1, n + 1):
		fact = fact * i
	return fact
user = input().split()
a = int(user[0])
b = int(user[1])
min1 = min(a, b)
print(solve(min1))


def fact(n):
	if n == 1:
		return 1
	return fact(n - 1) * n
a = min(map(int, input().split()))
print(fact(a))


from math import factorial as fact
print(fact(min(map(int, input().split()))))


(n, m) = map(int, input().split())
if m < n:
	n = m
o = 1
for i in range(2, n + 1):
	o *= i
print(o)


def factorial(n):
	if n == 1:
		return n
	else:
		return n * factorial(n - 1)
n = [int(i) for i in input().split()]
print(factorial(min(n[0], n[1])))


from math import factorial
(a, b) = [int(i) for i in input().split()]
min1 = min(a, b)
print(factorial(min1))


import math

def fact(x):
	k = 1
	for i in range(x):
		k = k * (i + 1)
	return k
x = input().split(' ')
a = int(x[0])
b = int(x[1])
print(fact(min(a, b)))


from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = 100000009

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		print(mid)
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1
(a, b) = mi()
print(factorial(min(a, b)))


import math
(x, y) = map(int, input().split())
if x > y:
	a = y
else:
	a = x
print(math.factorial(a))


(x, y) = map(int, input().split())
A = min(x, y)
mul = 1
for i in range(1, A + 1):
	mul *= i
print(mul)


from math import factorial
[a, b] = [int(x) for x in input().split()]
print(str(factorial(a)) + '\n') if a < b else print(str(factorial(b)))


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def factorial(n):
	m = 1
	for i in range(2, n + 1):
		m *= i
	return m

def find_val(a, b):
	return factorial(min(a, b))
t = 1
while t:
	t = t - 1
	points = []
	(n, m) = map(int, input().split())
	print(find_val(n, m))


f = [1, 1] + [0] * 11
for i in range(2, 13):
	f[i] = f[i - 1] * i
(a, b) = map(int, input().split())
print(f[min(a, b)])


(x, y) = input().split()
x = int(x)
y = int(y)

def fact(n):
	k = 1
	for i in range(2, n + 1):
		k = k * i
	return k
if x < y:
	print(fact(x))
else:
	print(fact(y))


(x, y) = list(map(int, input().split()))

def fact(x):
	f = 1
	for i in range(1, x + 1):
		f *= i
	return f
print(fact(min(x, y)))


import math
p = input()
p = p.split(' ')
a = int(p[0])
b = int(p[1])
if a >= b:
	print(math.factorial(b))
else:
	print(math.factorial(a))


import math
k = [int(x) for x in input().strip().split(' ')]
a = k[0]
b = k[1]
c = min(a, b)
print(math.factorial(c))


(n, m) = map(int, input().split())
count = 1
for i in range(1, min(n, m) + 1):
	count = count * i
print(count)


z = list(map(int, input().split()))
y = min(z)
a = 1
for i in range(y, 1, -1):
	a *= i
print(a)


def factorial(n):
	p = 1
	for i in range(1, n + 1):
		p *= i
	return p
ab = input().split()
a = int(ab[0])
b = int(ab[1])
print(factorial(min(a, b)))


def solve(test):
	(a, b) = map(int, input().split())
	ans = 1
	for i in range(1, min(a, b) + 1):
		ans *= i
	print(ans)
t = 1
for _ in range(t):
	solve(_ + 1)


import math as m
print(m.factorial(min([int(x) for x in input().split()])))


def fat(n):
	if n == 1:
		return 1
	else:
		return fat(n - 1) * n

def mdc(a, b):
	if b == 0:
		return a
	else:
		return mdc(b, a % b)
(a, b) = list(map(int, input().split()))
print(fat(min(a, b)))


(a, b) = map(int, input().split())
ans = 1
for x in range(2, min(a, b) + 1):
	ans *= x
print(ans)


(n, m) = map(int, input().split())
import math
q = math.factorial(min(n, m))
print(q)


lst = list(input().split())
a = lst[0]
b = lst[1]
if 0 in lst or 1 in lst:
	print(1)
else:
	answ = 1
	for i in range(1, min(int(a), int(b)) + 1):
		answ = answ * i
	print(answ)


from fractions import gcd
from math import factorial
(a, b) = map(int, input().split())
if a >= b:
	print(factorial(b))
if a < b:
	print(factorial(a))


(b, c) = map(int, input().split())
minn = min(b, c)
res = 1
for i in range(1, minn + 1):
	res = res * i
print(res)


(a, b) = map(int, input().split())
j = 1
if a > b:
	for i in range(1, b + 1):
		j = j * i
	print(j)
else:
	for i in range(1, a + 1):
		j = j * i
	print(j)


(x, y) = input().split(' ')
x = int(x)
y = int(y)

def ebob(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def ebobb(*args):
	return reduce(ebob, args)

def ekok(a, b):
	return a * b / ebob(a, b)

def ekokk(*args):
	return reduce(ekok, args)
if x <= 20 and y <= 20:
	carpim = 1
	carpims = 1
	for i in range(x):
		carpim *= i + 1
	for i in range(y):
		carpims *= i + 1
	k = ebob(carpim, carpims)
	print(k)
elif x >= 20 and y <= 20:
	carpim = 1
	carpims = 1
	for i in range(y):
		carpims *= i + 1
	print(carpims)
elif x <= 20 and y >= 20:
	carpim = 1
	carpims = 1
	for i in range(x):
		carpim *= i + 1
	print(carpim)
elif x >= 20 and y >= 20 and (x < y):
	carpim = 1
	carpims = 1
	for i in range(x):
		carpim *= i + 1
	print(carpim)
elif x >= 20 and y >= 20 and (x > y):
	carpim = 1
	carpims = 1
	for i in range(y):
		carpims *= i + 1
	print(carpims)


(a, b) = map(int, input().split())
op = 1
if a == 0 or b == 0:
	print('1')
elif a < b:
	for i in range(a):
		op *= i + 1
	print(op)
else:
	for i in range(b):
		op *= i + 1
	print(op)


import math
(a, b) = map(int, input().split())
s = min(a, b)
print(math.factorial(s))


arr1 = input().split()
a = int(arr1[0])
b = int(arr1[1])
c = int(min(a, b))
res = 1
for i in range(2, c + 1):
	res *= i
print(res)


import sys

def main():
	(a, b) = map(int, sys.stdin.readline().split())
	minimum = min(a, b)
	result = 1
	for num in range(1, minimum + 1):
		result *= num
	print(result)
main()


from fractions import gcd
import math
s = input()
a = int(s.split(' ')[0])
b = int(s.split(' ')[1])
if b < a:
	print(math.factorial(b))
else:
	print(math.factorial(a))


(a, b) = map(int, input().split())
k = min(a, b)
v = 1
for i in range(2, k + 1):
	v = v * i
print(v)


def gcd(x):
	if x == 1:
		return 1
	else:
		return x * gcd(x - 1)
(m, n) = map(int, input().split())
print(gcd(min(m, n)))


import math
t = list(map(int, input().split()))
t.sort()

def facto(a):
	x = 1
	for i in range(a):
		x = a * x
		a = a - 1
	return x
print(facto(t[0]))


(n, m) = map(int, input().split())
mn = min(n, m)
x = 1
for i in range(2, mn + 1):
	x *= i
print(x)


(a, b) = map(int, input().split())
c = min(a, b)
S = 1
for i in range(1, c + 1):
	S *= i
print(S)


(A, B) = map(int, input().split())
C = min(A, B)
k = 1
for x in range(1, C + 1):
	k = k * x
print(k)


def f(n):
	if n == 0:
		return 1
	else:
		return n * f(n - 1)
(a, b) = map(int, input().split())
print(f(min(a, b)))


from math import factorial
import sys

def Factorial(x):
	if x == 0:
		return 1
	else:
		return x * Factorial(x - 1)

def gcd(a, b):
	return b if a % b == 0 else gcd(b, a % b)
for num in sys.stdin:
	(a, b) = map(int, num.split(' '))
	mn = min(a, b)
	print(factorial(mn))


import math
(n, m) = [int(x) for x in input().split()]
if n < m:
	x = n
else:
	x = m
z = math.factorial(x)
print(z)


import math
(A, B) = list(map(int, input().split()))
res = min(A, B)
print(math.factorial(res))


(a, b) = input().split()
(a, b) = (int(a), int(b))
r = min(a, b)
t = 1
for i in range(r):
	t *= i + 1
print(t)


def fa(a):
	if a == 0:
		return 1
	else:
		return a * fa(a - 1)
(x, y) = list(map(int, input().split()))
if x >= y:
	print(fa(y))
else:
	print(fa(x))


import sys

def fac(a):
	if a == 0:
		return 1
	return fac(a - 1) * a
(a, b) = map(int, input().split())
print(fac(a)) if a < b else print(fac(b))


(a, b) = map(int, input().split())
m = min(a, b)
p = 1
for i in range(1, m + 1):
	p *= i
print(p)


def fact(i):
	for x in range(1, i):
		i = x * i
	return i
s = input().split(' ')
t = int(s[0])
c = int(s[1])
if t < c:
	print(fact(t))
else:
	print(fact(c))


import math
(a, b) = map(int, input().split())
ans = 1
for j in range(1, min(a, b) + 1):
	ans *= j
print(ans)


from math import *
(x, y) = [int(i) for i in input().split()]
ans = 1
N = min(x, y)
for i in range(1, N + 1):
	ans *= i
print(ans)


(num1, num2) = list(map(int, input().split(' ')))
num = 0
output = 1
if num1 < num2:
	num = num1
elif num1 > num2:
	num = num2
else:
	num = num1
for i in range(1, num + 1, 1):
	output *= i
print(output)


s = [int(i) for i in input().split()]
c = 1
a = 0
a = min(s[0], s[1])
for i in range(1, a + 1):
	c = c * i
print(c)


from sys import stdin
import math as mt
(a, b) = map(int, stdin.readline().split())
q = min(a, b)
print(mt.factorial(q))


r = lambda : map(int, input().split())
a = min(r())
c = 1
while a:
	c *= a
	a -= 1
print(c)


import math

def fac(m, n):
	return math.factorial(min(m, n))
(a, b) = map(int, input().split())
print(fac(a, b))


arr = [int(x) for x in input().split()]

def factorial(n):
	fact = 1
	if n <= 1:
		return 1
	i = 2
	while i <= n:
		fact *= i
		i += 1
	return fact
print(factorial(min(arr[1], arr[0])))


(A, B) = [int(i) for i in input().split()]
bound = min(A, B)
ans = 1
for i in range(1, bound + 1):
	ans *= i
print(ans)


def fact(a):
	s = 1
	for i in range(1, a + 1):
		s *= i
	return s
(a, b) = map(int, input().split())
print(fact(min(a, b)))


import math
n = list(map(int, input().split()))

def solve(n):
	print(math.factorial(min(n[0], n[1])))
solve(n)


from sys import stdin

def readline():
	return stdin.readline()

def solve(n, k):
	a = 1
	for i in range(1, min(n, k) + 1):
		a *= i
	return a
(n, k) = list(map(int, readline().rstrip('\n').split(' ')))
print(solve(n, k))


d = 1
(a, b) = map(int, input().split())
c = min(a, b)
for x in range(1, c + 1):
	d = x * d
print(d)


(x, y) = map(int, input().split())

def factorial(a):
	fact = 1
	for i in range(2, a + 1):
		fact *= i
	return fact
q = min(x, y)
print(factorial(q))


import math
import itertools

def ria():
	return [int(i) for i in input().split()]
print(math.factorial(min(ria())))


import math
st = input()
(a, b) = (int(x) for x in st.split())
ans = min(a, b)
ans = math.factorial(ans)
print(ans)


import math
(a, b) = map(int, input().split())
temp = min(a, b)
fact = 1
for i in range(1, temp + 1):
	fact = fact * i
print(fact)


(n, m) = map(int, input().strip().split()[:2])

def fact(a):
	s = 1
	for x in range(a, 0, -1):
		s = s * x
	return s
if n > m:
	print(fact(m))
else:
	print(fact(n))


import math
print(math.factorial(min([int(i) for i in input().split()])))


(n, m) = list(map(int, input().split()))
a = min(n, m)
x = 1
for i in range(2, a + 1):
	x *= i
print(x)


(a, b) = map(int, input().split())
factorial = 1
if a < b:
	for v in range(a, 1, -1):
		factorial *= v
	print(factorial)
elif a >= b:
	for v in range(b, 1, -1):
		factorial *= v
	print(factorial)


def fact(n):
	if n == 0:
		return 1
	else:
		return n * fact(n - 1)
(a, b) = input().strip().split(' ')
(a, b) = (int(a), int(b))
print(fact(min(a, b)))


from math import factorial as f
(a, b) = list(map(int, input().split()))
print(f(min(a, b)))


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
(a, b) = mi()
ans = math.factorial(min(a, b))
print(ans)


def fact(n):
	mult = 1
	for i in range(2, n + 1):
		mult *= i
	return mult
(x, y) = [int(elem) for elem in input().split()]
print(fact(min(x, y)))


def main():
	(n1, n2) = list(map(int, input().split()))
	print(fact(min(n1, n2)))

def fact(n):
	fac = 1
	for i in range(2, n + 1):
		fac *= i
	return fac
main()


import sys

def fact(n):
	f = 1
	for i in range(2, n + 1):
		f *= i
	return f
(a, b) = sorted(map(int, input().split()))
li = []
for i in range(1, 13):
	li.append(fact(i))
print(li[a - 1])


lis = input().split()
a = int(lis[0])
b = int(lis[1])
if a > b:
	a = b
ans = 1
for i in range(1, a + 1):
	ans *= i
print(ans)


def fact(x):
	if x == 1:
		return 1
	else:
		return fact(x - 1) * x
(n, m) = map(int, input().split())
if n > m:
	print(fact(m))
else:
	print(fact(n))


(A, B) = map(int, input().split())
a = []
count = 1
for i in range(1, min(A, B) + 1):
	count = count * i
	a.append(count)
print(a[-1])


def factorial(n):
	if n <= 1:
		return 1
	else:
		return n * factorial(n - 1)
(x, y) = map(int, input().split())
print(factorial(min([x, y])))


import math
(n, k) = list(map(int, input().split()))
print(math.factorial(min(n, k)))


def fact(a):
	prod = 1
	while a > 0:
		prod *= a
		a -= 1
	return prod
(a, b) = list(map(int, input().split()))
print(fact(min(a, b)))


num1 = input()
a = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr1 = get_the_data(0, num1, a)
min = 0
if arr1[0] < arr1[1]:
	min = arr1[0]
else:
	min = arr1[1]
divisor = 1
while min != 0:
	divisor *= min
	min -= 1
print(divisor)


import sys
import time
import math
import heapq
import collections
from io import StringIO
test_cases = [('\n3 3\n', '\n6\n')]

def solve():
	return 'TEST'

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

def main():
	(a, b) = map(int, input().split())
	result = math.factorial(min(a, b))
	print(result)

def test(s, check):
	s = s.strip()
	check = check.strip()
	sys.stdin = StringIO(s)
	sys.stdout = out = StringIO()
	start_time = time.time()
	try:
		main()
	finally:
		exec_time = time.time() - start_time
		sys.stdin = sys.__stdin__
		sys.stdout = sys.__stdout__
	out.seek(0)
	result = out.read().strip()
	status = 'SUCCESS' if result == check else 'FAILURE'
	message = 'status: {}, exec_time: {:.3f}'.format(status, exec_time)
	debug(message)

def test_all():
	for (s, check) in test_cases:
		test(s, check)
if len(sys.argv) > 1 and sys.argv[1] == '-t':
	test_all()
else:
	main()


x = input().split(' ')
a = int(x[0])
b = int(x[1])
c = min(a, b)
ans = 1
for i in range(1, c + 1):
	ans = ans * i
print(ans)


def factorial(x):
	fact = 1
	for i in range(1, x + 1):
		fact *= i
	return fact
(a, b) = (int(x) for x in input().split())
num = min(a, b)
result = factorial(num)
print(result)


(x, y) = map(int, input().split())
xx = min(x, y)
fact = 1
for i in range(1, xx + 1):
	fact *= i
print(fact)


(a, b) = map(int, input().split())
fac = min(a, b)
for x in range(1, fac):
	fac *= x
print(fac)


def fib(l):
	if l == 1:
		return 1
	else:
		return l * fib(l - 1)
(a, b) = map(int, input().split())
l = min(a, b)
print(fib(l))


(a, b) = map(int, input().split())
x = min(a, b)
res = 1
while x:
	res = res * x
	x -= 1
print(res)


(a, b) = map(int, input().split())
c = min(a, b)
r = 1
for i in range(2, c + 1):
	r *= i
print(r)


import math

def gcdOfFactorial(m, n):
	return math.factorial(min(m, n))
z = input
(m, n) = map(int, z().split())
print(gcdOfFactorial(m, n))


(a, b) = map(int, input().split())
m = min(a, b)
res = 1
for i in range(2, m + 1):
	res *= i
print(res)


n = [int(i) for i in input().split()]
c = 1
a = min(n)
for i in range(1, a + 1):
	c *= i
print(c)


res = 1
for i in range(2, min(map(int, input().split())) + 1):
	res *= i
print(res)


(a, b) = map(int, input().split())
x = min(a, b)
nb = x
for i in range(x - 1):
	nb *= i + 1
print(nb)


(a, b) = map(int, input().split())
m = 1
answer = 1
while m <= a and m <= b:
	answer = answer * m
	m = m + 1
print(answer)


n = min(list(map(int, input().split())))
f = 1
for i in range(1, n + 1):
	f *= i
print(f)


def fac(x):
	if x == 1:
		return 1
	return fac(x - 1) * x
(A, B) = map(int, input().split())
print(fac(min(A, B)))


(x, y) = [int(t) for t in input().split()]

def count_factorial(n):
	if n == 1:
		return 1
	else:
		return n * count_factorial(n - 1)
print(count_factorial(min(x, y)))


import math

def gcdOfFactorial(m, n):
	return math.factorial(min(m, n))
(m, n) = (int(x) for x in input().split())
print(gcdOfFactorial(m, n))


import math

def GCD():
	(x, y) = [int(x) for x in input().split()]
	if x <= y:
		print(math.factorial(x))
	elif x > y:
		print(math.factorial(y))
GCD()


import math

def greatest_divider(a, b):
	a = int(a)
	b = int(b)
	if a > b:
		return math.factorial(b)
	else:
		return math.factorial(a)

def main():
	(a, b) = input().split()
	c = greatest_divider(a, b)
	print(c)
main()


def fact(n, F=1):
	while True:
		if n == 1:
			return F
		(F, n) = (F * n, n - 1)
[x, y] = list(map(int, input().split()))
print(fact(min(x, y)))


def fact(c):
	h = 1
	for i in range(1, c + 1):
		h = h * i
	return h

def second(s):
	i = 0
	aa = ''
	while s[i] >= '0' and s[i] <= '9':
		i += 1
	while s[i] == ' ':
		i += 1
	while s[i] >= '0' and s[i] <= '9':
		aa = aa + s[i]
		i += 1
		if i == len(s):
			break
	return int(aa)

def first(s):
	i = 0
	bb = ''
	while s[i] >= '0' and s[i] <= '9':
		bb = bb + s[i]
		i += 1
	return int(bb)
s = input()
print(fact(min(second(s), first(s))))


import math

def bored(a, b):
	return math.factorial(min(a, b))
i = input().split()
print(bored(int(i[0]), int(i[1])))


def main():
	[a, b] = [int(_) for _ in input().split()]
	m = min(a, b)
	factorials = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600]
	print(factorials[m])
main()


def ComDiv():
	fact = 1
	IPT = input()
	iPT = IPT.split()
	A = int(iPT[0])
	B = int(iPT[1])
	min = A
	if A > B:
		min = B
	for x in range(1, min + 1):
		fact = fact * x
	print(fact)
ComDiv()


def f(x):
	return 1 if x == 0 else x * f(x - 1)
print(f(min(map(int, input().split()))))


from functools import reduce
(n, m) = map(int, input().split())
nm = min(n, m)
a = reduce(lambda x, y: x * y, range(1, nm + 1))
print(a)


import math
nums = [int(x) for x in input().split(' ')]
if nums[0] > nums[1]:
	print(math.factorial(nums[1]))
else:
	print(math.factorial(nums[0]))


def factorial(n):
	dp = [0] * (n + 1)
	dp[0] = 1
	dp[1] = 1
	for i in range(2, n + 1):
		dp[i] = i * dp[i - 1]
	return dp[n]
print(factorial(min(map(int, input().split()))))


(a, b) = map(int, input().split())
temp = min(a, b)
res = 1
for i in range(1, temp + 1):
	res = res * i
print(res)


line = input().split()

def factorial(num):
	if num <= 1:
		return 1
	else:
		return num * factorial(num - 1)
a = int(line[0])
b = int(line[1])
print(str(factorial(min(a, b))))


(a, b) = map(int, input().split())
a1 = 1
b1 = 1
if a < b:
	for i in range(1, a + 1):
		a1 *= i
	print(a1)
else:
	for i in range(1, b + 1):
		b1 *= i
	print(b1)


res = 1
for x in range(1, min(map(int, input().split(' '))) + 1):
	res *= x
print(res)


def fact(t):
	i = z = 1
	while i <= t:
		z *= i
		i += 1
	print(z)
(p, q) = map(int, input().split())
fact(min(p, q))


def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)
(n, m) = map(int, input().split())
print(factorial(min(n, m)))


out = 1
for s in range(min((int(m) for m in input().split()))):
	out = out * (s + 1)
print(out)


(A, B) = map(int, input().split())
if A > B:
	(A, B) = (B, A)
ans = 1
for x in range(1, A + 1):
	ans = ans * x
print(ans)


(A, B) = input().split()
(A, B) = (int(A), int(B))
Sum = 1
if A >= B:
	for i in range(1, B + 1):
		Sum = Sum * i
else:
	for j in range(1, A + 1):
		Sum = Sum * j
print(Sum)


(a, b) = map(int, input().split())
ans = min(a, b)
res = 1
while ans != 0:
	res = res * ans
	ans -= 1
print(res)


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

def lol(a, b):
	fib = 1
	if a > b:
		for i in range(1, b + 1):
			fib *= i
	else:
		for i in range(1, a + 1):
			fib *= i
	print(fib)
lol(a, b)


(a, b) = input().split()
a = int(a)
b = int(b)
if a > b:
	(a, b) = (b, a)
p = 1
for i in range(1, a + 1):
	p *= i
print(p)


def fact(a):
	prd = 1
	for i in range(1, a + 1):
		prd = prd * i
	return prd

def gcd(a, b):
	return fact(min(a, b))
(a, b) = input().split()
print(gcd(int(a), int(b)))


(n, k) = map(int, input().split())
res = min(n, k)
s = 1
for i in range(1, res + 1):
	s *= i
print(s)


(A, B) = [int(x) for x in input().split()]
a = 1
for i in range(1, min(A, B) + 1):
	a *= i
print(a)


def solve(A, B):
	ans = 1
	if A < B:
		for i in range(1, A + 1):
			ans *= i
	else:
		for i in range(1, B + 1):
			ans *= i
	return ans
(A, B) = [int(c) for c in input().split()]
print(solve(A, B))


from sys import stdin, stdout
from math import factorial
stdout.write(str(factorial(min(map(int, stdin.readline().split())))))


(A, B) = [int(i) for i in input().split()]
j = min(A, B)
i = 1
ans = 1
while i <= j:
	ans *= i
	i += 1
print(ans)


(a, b) = list(map(int, input().split()))
c = min(a, b)

def fact(n):
	res = 1
	for i in range(1, n + 1):
		res *= i
	return res
print(fact(c))


inp = input()
inp = inp.split(' ')
num_array = []
for current_num in inp:
	num_array.append(int(current_num))

def factorial(number):
	current_total = 1
	for i in range(1, number + 1):
		current_total *= i
	return current_total
print(factorial(min(num_array)))


z = input
import math
(n, m) = map(int, z().split())
print(math.factorial(min(n, m)))


def main():
	read = lambda : tuple(map(int, input().split()))
	(a, b) = read()
	c = min(a, b)
	ans = 1
	for i in range(1, c + 1):
		ans *= i
	print(ans)
main()


def fact(x):
	r = 1
	for i in range(2, x + 1):
		r = r * i
	return r
ch = input('')
l = ch.split(' ')
a = int(l[0])
b = int(l[1])
print(fact(min(a, b)))


from operator import mul
from functools import reduce

def fact(n):
	return reduce(mul, range(1, n + 1), 1)
(a, b) = map(int, input().split())
print(fact(a) if a < b else fact(b))


def factor(n):
	if n == 1:
		return 1
	else:
		return n * factor(n - 1)
(a, b) = map(int, input().split())
if a <= b:
	print(factor(a))
else:
	print(factor(b))


def fact(x):
	t = 1
	if x == 1 or x == 0:
		return 1
	for i in range(x):
		t *= i + 1
	return t
(a, b) = input().split()
a = int(a)
b = int(b)
print(fact(min(a, b)))


(a, b) = input().split()
a = int(a)
b = int(b)
aa = 1
bb = 1
if a < b:
	for i in range(1, a + 1):
		aa = aa * i
	print(aa)
if b <= a:
	for i in range(1, b + 1):
		bb = bb * i
	print(bb)


(a, b) = list(map(int, input().split()))
x = min(a, b)
y = 1
for i in range(1, x + 1):
	y *= i
print(y)


c = min(map(int, input().split()))
s = 1
for i in range(1, c + 1):
	s *= i
print(s)


import math
s = input()
L = s.split()
a = int(L[0])
b = int(L[1])
if a < b:
	x = math.factorial(a)
else:
	x = math.factorial(b)
print(x)


def fact(n):
	if n == 0:
		return 1
	else:
		fact = 1
		for i in range(1, n + 1):
			fact = fact * i
		return fact
(A, B) = map(int, input().split())
print(fact(min(A, B)))


from math import factorial

def solve():
	(a, b) = [int(s) for s in input().split()]
	print(factorial(min(a, b)))
solve()


import math
a = list(map(int, input().split()))
x = max(a)
y = min(a)
print(math.factorial(y))


l = list(map(int, input().split()))
x = min(l)
import math as m
print(m.factorial(x))


(x, y) = map(int, input().split())
mini = min(x, y)
ans = 1
for i in range(1, mini + 1):
	ans *= i
print(ans)


(A, B) = (int(i) for i in input().split())
m = min(A, B)
clc = 1
for i in range(1, m + 1):
	clc *= i
print(clc)


l = input().split(' ')
a = int(l[0])
b = int(l[1])
if b < a:
	t = a
	a = b
	b = t
res = 1
for i in range(1, a + 1):
	res = res * i
print(res)


import math
(a, b) = list(map(int, input().strip().split()))
minimum = min([a, b])
print(math.factorial(minimum))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
(a, b) = get_list()
m = min(a, b)
result = 1
for i in range(2, m + 1):
	result *= i
print(result)


from math import gcd, factorial
l = list(map(int, input().split()))
a = l[0]
b = l[1]
if a > b:
	print(factorial(b))
else:
	print(factorial(a))


def f(a):
	if a == 1:
		return 1
	else:
		return a * f(a - 1)
l = list(map(int, input().split()))
print(f(min(l[0], l[1])))


import math
inp = input().split()
a = int(inp[0])
b = int(inp[1])
c = min(a, b)
print(math.factorial(c))


import math
(a, b) = list(map(int, input().strip().split()))
if a <= b:
	print(math.factorial(a))
else:
	print(math.factorial(b))


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	(a, b) = mp()
	print(math.factorial(min(a, b)))
for _ in range(1):
	solve()


(A, B) = map(int, input().split())
A = min(A, B)
res = 1
for i in range(A):
	res *= i + 1
print(res)


from math import factorial as f
print(f(min(map(int, input().split()))))


import math
(a, b) = map(int, input().split())
(i, x) = (2, min(a, b))
while x < math.factorial(min(a, b)):
	x *= i
	i += 1
print(x)


import math

def nod(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
(a, b) = list(map(int, input().split()))
print(math.factorial(min(a, b)))


k = list(map(int, input().split()))
s = min(k)
fact = 1
for i in range(1, s + 1):
	fact = fact * i
print(fact)


def factorial(n):
	if n == 1:
		return 1
	return n * factorial(n - 1)
nums = [int(n) for n in input().split()]
m = min(nums)
print(factorial(m))


def fact(c):
	f = 1
	for i in range(2, c + 1, 1):
		f = f * i
	return f
(a, b) = map(int, input().split())
c = min(a, b)
print(fact(c))


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

def fac(a):
	if a == 0:
		return 1
	return a * fac(a - 1)
print(fac(min(a, b)))


def fact(a):
	if a == 0:
		return 1
	return a * fact(a - 1)
(a, b) = input().split(' ')
print(fact(min(int(a), int(b))))


def fac(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
(a, b) = map(int, input().split())
print(fac(min(a, b)))


import sys
import math
print(math.factorial(min(map(int, input().split()))))


import sys, math
inputs = iter(sys.stdin.readlines())
a = min(map(int, next(inputs).split()))
print(math.factorial(a))


import math
l = list(map(int, input().split()))
a = min(l)
b = max(l)
_a = 1
_b = 1
for i in range(1, a + 1):
	if i <= a:
		_a = _a * i
print(_a)


(n, m) = map(int, input().split())
if n > m:
	min = m
else:
	min = n
k = 1
for i in range(2, min + 1):
	k = k * i
print(k)


l = input()
l = l.split()
a = int(l[0])
b = int(l[1])
if a < b:
	ans = 1
	for i in range(2, a + 1):
		ans *= i
	print(ans)
else:
	ans = 1
	for i in range(2, b + 1):
		ans *= i
	print(ans)


[n, k] = list(map(int, input().split()))
a = max(n, k) - min(n, k)
p = 1
for i in range(1, min(n, k) + 1):
	p *= i
print(p)


def factorial(x):
	if x <= 1:
		return 1
	return x * factorial(x - 1)
l = input().split()
(a, b) = (int(l[0]), int(l[-1]))
print(factorial(min(a, b)))


_ = input().strip().split(' ')
(a, b) = (int(_[0]), int(_[1]))
a = min(a, b)
p = 1
while a > 1:
	p = a * p
	a = a - 1
print(p)


def fact(A):
	t = 1
	while A > 1:
		t *= A
		A -= 1
	return t
(A, B) = map(int, input().split())
if A == B:
	print(fact(A))
elif A > B:
	print(fact(B))
else:
	print(fact(A))


(a, b) = input().split()
a = int(a)
b = int(b)
s = 1
if a >= b:
	for i in range(1, b + 1):
		s = s * i
else:
	for i in range(1, a + 1):
		s = s * i
print(s)


import math
(A, B) = map(int, input().split())
x = min(A, B)
print(math.factorial(x))


def main():
	(a, b) = map(int, input().split())
	m = min(a, b)
	ans = 1
	for i in range(2, m + 1):
		ans *= i
	print(ans)
main()


from math import factorial
(a, b) = [int(s) for s in input().split()]
if a > b:
	print(factorial(b))
else:
	print(factorial(a))


import math
l = [int(x) for x in input().strip().split(' ')]
a = l[0]
b = l[1]
m = min(a, b)
print(math.factorial(m))


import math
n = input()
(a, b) = (int(x) for x in n.split())
f = math.factorial(min(a, b))
print(f)


(a, b) = [int(x) for x in input().split()]
fact = 1
temp = 0
if a > b:
	a = a
	b = b
else:
	temp = a
	a = b
	b = temp
for i in range(1, b + 1):
	fact *= i
print(fact)


def fact(n):
	if n == 1:
		return 1
	else:
		return n * fact(n - 1)
(a, b) = map(int, input().split())
if a <= b:
	ans = fact(a)
else:
	ans = fact(b)
print(ans)


import math
(A, B) = map(int, input().split(' '))
C = min(A, B)
print(math.factorial(C))


from math import gcd
(a, b) = input().split()
(a, b) = (int(a), int(b))

def fact(n):
	s = 1
	for i in range(1, n + 1):
		s *= i
	return s
print(fact(min(a, b)))


(n, d) = map(int, input().split(' '))
sum = 1
if n <= d:
	k = n
else:
	k = d
for i in range(1, k + 1):
	sum = sum * i
print(sum)


(a, b) = map(int, input().strip().split())
val = 1
for i in range(1, min(a, b) + 1):
	val = val * i
print(val)


import sys
import math
import itertools
import collections

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

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

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
print(math.factorial(min(mi())))


(n, m) = [int(x) for x in input().split()]
ans = 1
for i in range(1, min(n, m) + 1):
	ans *= i
print(ans)


from math import factorial
(a, b) = tuple(map(int, input().split()))
if a > b:
	a = b
print(factorial(a))


from math import *
(n, m) = map(int, input().split())
nf = min(n, m)
mf = factorial(nf)
print(mf)


N = [int(i) for i in input().split()]
a = N[0]
b = N[1]
if a > b:
	a = b
k = 1
i = 2
while i < a + 1:
	k = k * i
	i = i + 1
print(k)


from math import factorial
r = min(map(int, input().split()))
print(factorial(r))


def ans(a, b):
	Min = min(a, b)
	ans = 1
	for i in range(1, Min + 1):
		ans *= i
	return ans
(a, b) = map(int, input().split())
print(ans(a, b))


def fact(a):
	c = 1
	for i in range(1, a + 1):
		c = c * i
	return c
(x, y) = map(int, input().split())
print(fact(min(x, y)))


import math
a = [int(i) for i in input().split(' ')]
n = a[0]
m = a[1]
print(math.factorial(min(n, m)))


import math
(a, b) = map(int, input().split())
d = min(a, b)
print(math.factorial(d))


def factorial(x):
	ans = 1
	for i in range(1, x + 1):
		ans *= i
	return ans
(a, b) = map(int, input().split())
print(factorial(min(a, b)))


(a, b) = map(int, input().split())
if a < b:
	fa = 1
	for i in range(1, a + 1):
		fa = fa * i
	print(fa)
else:
	fb = 1
	for i in range(1, b + 1):
		fb = fb * i
	print(fb)


def fact(n):
	if n == 0 or n == 1:
		return 1
	return n * fact(n - 1)
(a, b) = input().split()
a = int(a)
b = int(b)
if a < b:
	print(fact(a))
else:
	print(fact(b))


from functools import reduce
from operator import mul

def read_number_line():
	return [int(i) for i in input().split()]
(a, b) = read_number_line()
print(reduce(mul, range(1, min(a, b) + 1)))


import math

def fact(n):
	f = 1
	for i in range(1, n + 1):
		f = f * i
	return f
(a, b) = map(int, input().split())
x = min(a, b)
n1 = fact(x)
print(n1)


import math
f = lambda : map(int, input().split())
print(math.factorial(min(f())))


def factorial(n):
	if n == 0:
		return 1
	else:
		return n * factorial(n - 1)
string = input().split(' ')
A = int(string[0])
B = int(string[1])
if A > B:
	print(str(factorial(B)))
else:
	print(str(factorial(A)))


from sys import stdin

def mcd(a, b):
	if a < b:
		if a == 1:
			return a
		else:
			return mcd(a - 1, b) * a
	elif b == 1:
		return b
	else:
		return mcd(a, b - 1) * b

def main():
	(a, b) = stdin.readline().strip().split()
	a = int(a)
	b = int(b)
	z = mcd(a, b)
	print(z)
main()


def f(t):
	if t == 1:
		return 1
	return t * f(t - 1)
(a, b) = list(map(int, input().split()))
print(f(min(a, b)))


print(__import__('math').factorial(min(map(int, input().split()))))


c = 1
(a, b) = map(int, input().split())
if a < b:
	(a, b) = (b, a)
	for k in range(2, b + 1):
		c *= k
else:
	for k in range(2, b + 1):
		c *= k
print(c)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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 I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(a, b) = LI()
	(a, b) = sorted([a, b])
	ans = 1
	for i in range(2, a + 1):
		ans *= i
	return ans
print(main())


def fact(n):
	if n == 0:
		return 1
	else:
		return n * fact(n - 1)
(a, b) = map(int, input().split())
c = min(a, b)
print(fact(c))


def factorial(a):
	if a == 0 or a == 1:
		return 1
	else:
		return a * factorial(a - 1)
[a, b] = list(map(int, input().split(' ')))
print(factorial(min(a, b)))


import math
(i, j) = map(int, input().split(' '))
print(math.factorial(min(i, j)))


def fact(n):
	ret = 1
	for i in range(1, n + 1):
		ret *= i
	return ret
(a, b) = map(int, input().split())
if a > b:
	tmp = a
	a = b
	b = tmp
print(fact(a))


import math
(a, b) = map(int, input().split())
min = 0
if a > b:
	min = b
else:
	min = a
print(math.factorial(min))


def f(n):
	if n == 1:
		return 1
	return n * f(n - 1)
(a, b) = list(map(int, input().split()))
c = min(a, b)
print(f(c))


def tree_fact(l, r):
	return r if l == r else tree_fact(l, (l + r) // 2) * tree_fact((l + r) // 2 + 1, r)
(a, b) = map(int, input().split())
print(tree_fact(1, min(a, b)))


import math
(n, m) = map(int, input().split())
k = math.gcd(n, m)
k1 = math.factorial(min(n, m))
print(k1)


import math
(a, b) = map(int, input().split())
z = min(a, b)
print(math.factorial(z))


import math
(a, b) = tuple(map(int, input().split(' ')))
print(math.factorial(min(a, b)))


import math
(a, b) = input().strip().split()
(a, b) = [int(a), int(b)]
x = min(a, b)
print(math.factorial(x))


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

def facty(fact):
	if fact <= 1:
		return 1
	else:
		return facty(fact - 1) * fact
print(facty(fact))


(a, b) = sorted(map(int, input().split()))
result = 1
for i in range(1, a + 1):
	result *= i
print(result)


def fact(n):
	ans = 1
	for k in range(2, n + 1):
		ans *= k
	return ans
(a, b) = map(int, input().split())
print(fact(min(a, b)))


s = input()
a = []
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])

def fac(x):
	sum = 1
	for i in range(1, x + 1):
		sum *= i
	return sum
if a[0] < a[1]:
	print(fac(a[0]))
else:
	print(fac(a[1]))


(n, m) = list(map(int, input().split()))
pr = 1
for i in range(1, min(n, m) + 1):
	pr *= i
print(pr)


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

def factorial(num):
	if num == 1:
		return 1
	else:
		return num * factorial(num - 1)
if a < b:
	print(factorial(a))
else:
	print(factorial(b))


from math import gcd
(x, y) = [int(i) for i in input().split()]

class MyTask:

	def factorial(self, x):
		if x < 1:
			raise Exception('negative number not allowed')
		if x == 1:
			return 1
		elif x == 2:
			return 2
		else:
			w = self.factorial(x - 1) * x
			return w

	def resolve(self, x, y):
		c = min(x, y)
		return self.factorial(c)
task = MyTask()
print(task.resolve(x, y))


from collections import deque
from math import log, sqrt, ceil

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def fact(n):
	f = 1
	for i in range(1, n + 1):
		f *= i
	return f
(n, m) = mi()
a = min(n, m)
print(fact(a))


import functools

def factorial(n):
	return functools.reduce(lambda a, b: a * b, range(1, n + 1), 1)

def solve(inp):
	(a, b) = map(int, inp.split(' ', 1))
	return factorial(min(a, b))
print(solve(input()))


import math
n = input()
l = n.split()
a = int(l[0])
b = int(l[1])
if a > b:
	print(math.factorial(b))
else:
	print(math.factorial(a))


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

def f(s):
	return s * f(s - 1) if s > 1 else 1

def gcd(n, m):
	return gcd(min(m, n), max(n, m) % min(m, n)) if max(n, m) % min(m, n) else min(m, n)
print(f(min(a, b)))


def factorial(n):
	if n == 0:
		return 1
	else:
		return n * factorial(n - 1)
(a, b) = input().split()
(a, b) = [int(a), int(b)]
if a > b:
	aux = a
	a = b
	b = aux
print(factorial(a))


import sys
sys.setrecursionlimit(399603090)
nmbrs = input()
numbers = nmbrs.split(' ')
var1 = int(numbers[0])
var2 = int(numbers[1])
alist = [0]

def factorial(x):
	if x == 1:
		return 1
	else:
		return x * factorial(x - 1)
if var2 >= var1:
	print(factorial(var1))
if var1 > var2:
	print(factorial(var2))


(a, b) = map(int, input().split())
j = 1
answer = 1
while j <= min(a, b):
	answer *= j
	j += 1
print(answer)


def factorial(n):
	result = 1
	for i in range(1, n + 1):
		result *= i
	return result
(m, n) = map(int, input().split())
print(factorial(min(m, n)))


def foo(n):
	if n == 1:
		return 1
	return n * foo(n - 1)
(a, b) = map(int, input().split())
m = min(a, b)
print(foo(m))


import math
(n, k) = map(int, input().split())
a = min(n, k)
print(math.factorial(a))


def solve(a, b):
	s = 1
	for i in range(1, min(a, b) + 1):
		s *= i
	return s

def main():
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))
main()


def nod(n):
	p = 1
	for i in range(1, n + 1, 1):
		p = p * i
	return p
(a, b) = input().strip().split()
a = int(a)
b = int(b)
if a > b:
	print(nod(b))
else:
	print(nod(a))


def facto(n):
	f = 1
	for k in range(1, n + 1):
		f *= k
	return f
L = input()
L = L.split()
a = int(L[0])
b = int(L[1])
if a <= b:
	print(facto(a))
else:
	print(facto(b))


def fat(n):
	fatorial = 1
	for i in range(1, n + 1):
		fatorial = fatorial * i
	return fatorial
print(fat(min(map(int, input().split(' ')))))


from math import *
numbers = input().split()
mini = min(int(numbers[0]), int(numbers[1]))

def fact(n):
	x = 1
	for i in range(2, n + 1):
		x *= i
	return x
print(fact(mini))


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

def fac(n):
	m = 1
	for _ in range(1, n + 1)[::-1]:
		m *= _
	return m
print(fac(min(n, m)))


def fact(x):
	fc = 1
	for i in range(1, x + 1):
		fc *= i
	return fc
(n, m) = [int(x) for x in input().split()]
if n > m:
	print(fact(m))
else:
	print(fact(n))


import math
(a, b) = map(int, input().split())
save = min(a, b)
print(math.factorial(save))


import math
(a, b) = list(map(int, input().split()))
af = 1
for i in range(1, min(a, b) + 1):
	af *= i
print(af)


import math
t = list(map(int, input().split()))
n = t[0]
m = t[1]
if n < m:
	print(math.factorial(n))
else:
	print(math.factorial(m))


s = input()
(a, b) = [int(x) for x in s.split()]
num = min(a, b)
f = 1
for i in range(1, num + 1):
	f *= i
print(f)


def fact(a):
	cnt = 1
	while a != 1:
		cnt *= a
		a -= 1
	return cnt

def solve(a, b):
	n = max(a, b)
	m = min(a, b)
	return fact(m)
(n, m) = map(int, input().split(' '))
k = solve(n, m)
print(k)


(a, b) = map(int, input().split())
c = min(a, b)
a = 1
i = 1
while i <= c:
	a = a * i
	i += 1
print(a)


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

def f(n):
	if n == 1 or n == 0:
		return 1
	return n * f(n - 1)
print(f(min(x, m)))


n = input().split()
a = 1
for i in range(2, min(int(n[0]), int(n[1])) + 1):
	a *= i
print(a)


from functools import reduce
print(reduce(lambda x, y: x * y, [x for x in range(1, min(list(map(int, input().split()))) + 1)]))


def factorial(n, x):
	if x <= 1:
		return n
	return factorial(n * x, x - 1)

def solve(a, b):
	return factorial(1, min(a, b))

def main():
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))
main()


(a, b) = map(int, input().split())
c = min(a, b)
d = 1
while c > 1:
	d = d * c
	c = c - 1
print(d)


from math import factorial
(a, b) = tuple(input().split())
a = int(a)
b = int(b)
print(factorial(min(a, b)))


n = min(map(int, input().split()))
import math
print(math.factorial(n))


import math
(a, b) = map(int, input().split())
res = min(a, b)
print(math.factorial(res))


def inp():
	return map(int, input().split())
(n, m) = inp()
res = 1
for i in range(1, min(n, m) + 1):
	res *= i
print(res)


list1 = [int(x) for x in input().split(' ')]
c = min(list1)
temp = 1
while c:
	temp *= c
	c -= 1
print(temp)


def recur_factorial(n):
	if n == 1:
		return 1
	else:
		return n * recur_factorial(n - 1)
(n, m) = list(map(int, input().split()))
if n > m:
	print(recur_factorial(m))
else:
	print(recur_factorial(n))


def fact(n):
	if n == 0:
		return 1
	else:
		return n * fact(n - 1)
b = (int(x) for x in input().split())
a = min(b)
print(fact(a))


(a, b) = map(int, input().split())
a = min(a, b)
k = lambda x: x * k(x - 1) if x > 1 else 1
print(k(a))


strList2IntList = lambda sl: list(map(int, sl.split()))

def main():
	data = strList2IntList(input())
	minInt = min(data)
	fac = 1
	for i in range(1, minInt + 1):
		fac *= i
	print(fac)
main()


import math
(A, B) = (int(x) for x in input().split())
print(math.factorial(min(A, B)))


import math
given = input().split(' ')
print(math.factorial(min(int(given[0]), int(given[1]))))


import math
x = input().split()
print(math.factorial(min(int(x[0]), int(x[1]))))


a = input()
for i in range(0, len(a), 1):
	if a[i] == ' ':
		break
b = int(a[0:i + 1])
c = int(a[i + 1:])
d = min(b, c)
fact = 1
for i in range(d, 1, -1):
	fact *= i
print(fact)


n = list(map(int, input().split()))
p = min(n)
if p == 0:
	print('1')
else:
	c = 1
	for i in range(p, 0, -1):
		c *= i
	print(c)


from fractions import gcd
from math import factorial as fact
(a, b) = map(int, input().split())
(a, b) = (min(a, b), max(a, b))
if b < 500:
	print(gcd(fact(a), fact(b)))
	exit()
print(fact(a))


(a, b) = input('').split()
a = int(a)
b = int(b)
if a >= b:
	i = b
	x = 1
	while i != 0:
		x = x * i
		i = i - 1
else:
	i = a
	x = 1
	while i != 0:
		x = x * i
		i = i - 1
print(x)


import sys
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(sys.stdin.readline())
writeln = lambda x: sys.stdout.write(str(x) + '\n')
write = lambda x: sys.stdout.write(x)
(A, B) = map(int, read().split())
m = min(A, B)
v = 1
for i in range(1, m + 1):
	v *= i
writeln(v)


def fac1(n):
	fac = 1
	i = 0
	while i < n:
		i += 1
		fac = fac * i
	return fac

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def gcdfac(x, y):
	if x > y:
		return fac1(y)
	else:
		return fac1(x)
(x, y) = map(int, input().split())
print(gcdfac(x, y))


def fact(n):
	f = 1
	for i in range(2, n + 1):
		f = f * i
	return f
(a, b) = input().split()
a = int(a)
b = int(b)
if a > b:
	print(fact(b))
else:
	print(fact(a))


def fatorial(x):
	if x == 0:
		return 1
	return x * fatorial(x - 1)
print(fatorial(min([int(i) for i in input().split()])))
exit(0)


import math
(p, q) = list(map(int, input().split()))
k = min(p, q)
print(math.factorial(k))


(n1, n2) = map(int, input().split())
arr_1 = []
arr_2 = []
arr_final = []
ans = 1
if n1 >= n2:
	for i in range(1, n2 + 1):
		ans *= i
else:
	for i in range(1, n1 + 1):
		ans *= i
print(ans)


def get_fractional(num):
	x = 1
	for y in range(1, num + 1):
		x = x * y
	return x
(a, b) = map(int, input().split())
if a < b:
	st = a
else:
	st = b
print(get_fractional(st))


a = input().split()
a = min(int(a[0]), int(a[1]))
ans = 1
for i in range(1, a + 1):
	ans *= i
print(ans)


inp = [int(x) for x in input().split()]
A = int(inp[0])
B = int(inp[1])
ans = 1
for i in range(1, min(A, B) + 1):
	ans *= i
print(ans)


import functools
(a, b) = map(int, input().split())
print(functools.reduce(lambda x, y: x * y, [i for i in range(1, min(a, b) + 1)], 1))


def fact(a):
	s = 1
	for i in range(1, a + 1):
		s *= i
	return s
(A, B) = map(int, input().split())
print(fact(min(A, B)))


import sys
import math
import bisect

def main():
	(a, b) = map(int, input().split())
	ans = 1
	for i in range(1, min(a, b) + 1):
		ans *= i
	print(ans)
main()


from math import *
(a, b) = map(int, input().split())
x = int(min(a, b))
nod = 1
for i in range(1, x + 1):
	nod *= i
print(nod)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
(n, m) = map(int, input().split())
m = min(n, m)
ans = 1
for i in range(1, m + 1):
	ans *= i
print(ans)


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

def fact(a):
	if a == 0:
		return 1
	return a * fact(a - 1)
print(fact(min(A, B)))


from sys import stdin, stdout
import bisect

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()

def re(x, k=1):
	if x == 0:
		return k
	else:
		return re(x - 1, k * x)
(n, m) = mi()
print(re(min(n, m)))


t = 1
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	ans = 1
	n = min(a, b)
	for i in range(1, n + 1):
		ans *= i
	print(ans)


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

def factorial(a):
	f = 1
	for i in range(2, a + 1):
		f *= i
	print(f)
factorial(p)


import math as mt
(a, b) = map(int, input().split())
print(mt.factorial(min(a, b)))


def read():
	return [int(x) for x in input().split()]

def factorial(n):
	if n == 1:
		return 1
	return n * factorial(n - 1)

def divisor(x, y):
	return factorial(min(x, y))
(x, y) = read()
print(divisor(x, y))


(num1, num2) = map(int, input().split(' '))

def factorial(n):
	return 1 if n == 1 or n == 0 else n * factorial(n - 1)
x = min(num1, num2)
print(factorial(x))


import math
s = input().split()
a = int(s[0])
b = int(s[1])
print(math.factorial(min(a, b)))


def f(x):
	if x == 0:
		return 1
	else:
		return x * f(x - 1)
a = input().split()
x = int(a[0])
y = int(a[1])
print(f(min(x, y)))


from fractions import gcd
from math import factorial
(x, y) = map(int, input().split())
a = min(x, y)
print(factorial(a))


import math
(n, m) = [int(x) for x in input().split()]
mn = min(n, m)
res = math.factorial(mn)
print(res)


before = input()
before_2 = before.split()
before_3 = list(map(int, before_2))

def smaller_number(a):
	if a[0] > a[1]:
		return a[1]
	else:
		return a[0]

def factorial(n):
	answer = 1
	for i in range(1, n + 1):
		answer = answer * i
	return answer
answer = smaller_number(before_3)
final_answer = factorial(answer)
print(final_answer)


import math
(a, b) = (int(n) for n in input().split())
ans = 1
for i in range(1, min(a, b) + 1):
	ans *= i
print(ans)


import math

def gcdOfFactorial(m, n):
	return math.factorial(min(m, n))
s = input().split()
m = int(s[0])
n = int(s[1])
print(gcdOfFactorial(m, n))


def UCLL(a, b):
	x = max(a, b)
	lst = []
	for i in range(x):
		try:
			if a % i == 0 and b % i == 0:
				lst.append(i)
		except Exception as e:
			pass
	return max(lst)

def giaithua(a):
	if a == 0:
		return 1
	return a * giaithua(a - 1)
(a, b) = map(int, input().split())
min = min(a, b)
y = giaithua(min)
print(y)


(x, y) = map(int, input().split())
if x > y:
	(x, y) = (y, x)
ans = 1
for i in range(1, x + 1):
	ans = ans * i
print(ans)


import math
(n, k) = map(int, input().split())
i = 1
a = 1
while i <= min(n, k):
	a = a * i
	i = i + 1
print(a)


import math
(a, b) = map(int, input().split())
f1 = math.factorial(min(a, b))
print(f1)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(a, b) = mi()
t = 1
for i in range(2, min(a, b) + 1):
	t *= i
print(t)


def fac(n):
	if n < 2:
		return 1
	return n * fac(n - 1)
a = input().split()
n = int(a[0])
m = int(a[1])
if n > m:
	n = m
print(fac(n))


def fact(a):
	if a == 0:
		return 1
	if a == 1:
		return 1
	return a * fact(a - 1)
temp = [int(x) for x in input().strip().split(' ')]
a = temp[0]
b = temp[1]
a = min(a, b)
print(fact(a))


def get_common_div():
	(A, B) = map(int, input().split())
	fact = 1
	i = 1
	while i <= min(A, B):
		fact = fact * i
		i = i + 1
	return fact
print(get_common_div())


from math import factorial as f
(a, b) = [int(x) for x in input().split()]
print(f(min(a, b)))


import math
math.factorial(1000)
(a, b) = [int(x) for x in input().split()]
if a < b:
	print(math.factorial(a))
else:
	print(math.factorial(b))


def fact(num):
	if num <= 1:
		return 1
	else:
		return num * fact(num - 1)
(a, b) = input().split()
a = int(a)
b = int(b)
if a > b:
	gcd = fact(b)
else:
	gcd = fact(a)
print(gcd)


def factorial(n):
	if n == 1 or n == 0:
		return 1
	else:
		return n * factorial(n - 1)
(a, b) = map(int, input().split())
min1 = min(a, b)
print(factorial(min1))


import sys
from math import sqrt, floor, factorial
from collections import deque
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	(a, b) = read()
	i = 1
	print(factorial(min(a, b)))
solve()


def Min(a, b):
	if a > b:
		return b
	else:
		return a

def calc(x, p):
	res = 0
	while x > 0:
		res = res + x // p
		x = x // p
	return res
prime = [2, 3, 5, 7, 11]
(a, b) = map(int, input().split())
ans = 1
for v in prime:
	ans = ans * v ** min(calc(a, v), calc(b, v))
print(ans)


from math import factorial
n = [int(i) for i in input().split()]
print(factorial(min(n)))


def fac(a):
	if a == 0:
		return 1
	return a * fac(a - 1)
l = list(map(int, input().split()))
print(fac(min(l)))


(a, b) = map(int, input().split())
z = min(a, b)
fact = 1
for i in range(1, z + 1):
	fact *= i
print(fact)


import math
(num1, num2) = map(int, input().split())
m = min(num1, num2)
print(math.factorial(m))


r = input().split()
a = int(r[0])
b = int(r[1])

def facti(t):
	if t == 1 or t == 0:
		return 1
	return t * facti(t - 1)
c = min(a, b)
print(int(facti(c)))


def jc(a):
	l = 1
	for i in range(2, a + 1):
		l *= i
	return l
(a, b) = map(int, input().split())
print(jc(min(a, b)))


(x, y) = map(int, input().split(' '))
c = min(x, y)
s = 1
i = 1
while i <= c:
	s = s * i
	i = i + 1
print(s)


(n1, n2) = map(int, input().split(' '))
value = min(n1, n2)
sum = 1
for i in range(1, value + 1):
	sum = sum * i
print(sum)


def f(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * f(n - 1)
(a, b) = [int(i) for i in input().split()]
print(f(min(a, b)))


(a, b) = map(int, input().split())
c = min(a, b)
f = 1
counter = 1
while counter <= c:
	f = f * counter
	counter += 1
print(f)


def fac(n):
	if n < 3:
		return n
	return n * fac(n - 1)
(a, b) = map(int, input().split())
print(fac(min(a, b)))


(a, b) = map(lambda x: int(x), input().split())
min_num = min(a, b)
(fact, sout) = (1, 1)
while fact <= min_num:
	sout = fact * sout
	fact += 1
print(sout)


import math

def f():
	n = min(map(int, input().split()))
	return math.factorial(n)
print(f())


fact = [0] * 13
fact[0] = 1
for i in range(1, len(fact)):
	fact[i] = fact[i - 1] * i
[a, b] = list(map(int, input().split()))
print(fact[min(a, b)])


def fact(n):
	if n == 1:
		return 1
	return n * fact(n - 1)
(x, y) = map(int, input().split())
print(fact(min(x, y)))


import math
ans = 1
(minimum, b) = map(int, input().split())
minimum = min(minimum, b)
while minimum > 0:
	ans *= minimum
	minimum = minimum - 1
print(ans)


def fak(n):
	if n == 1:
		return 1
	else:
		return n * fak(n - 1)
print(fak(min(map(int, input().split()))))


def fct(t):
	if t <= 0:
		return 1
	else:
		return t * fct(t - 1)
(n, m) = map(int, input().split())
t = min(n, m)
print(fct(t))


(A, B) = [int(s) for s in input().split()]
res = 1
if A > B:
	for i in range(1, B + 1):
		res *= i
	print(res)
elif B > A:
	for i in range(1, A + 1):
		res *= i
	print(res)
else:
	for i in range(1, A + 1):
		res *= i
	print(res)


def factorial(n):
	fact = 1
	for i in range(2, n + 1):
		fact = fact * i
	return fact
a = [int(i) for i in input().split()]
if a[0] < a[1]:
	t = a[0]
else:
	t = a[1]
print(factorial(t))


import math
(a, b) = map(int, input().split())
menor = min(a, b)
print(math.factorial(menor))


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)
(A, B) = map(int, input().split())
X = 0
if A > B:
	X = B
else:
	X = A
print(fact(X))


import sys
inf = float('inf')
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
mini = min(n, m)
print(factorial(mini))


def fact(num):
	val = 1
	for i in range(1, num + 1):
		val = val * i
	return val
(a, b) = input().split()
a = int(a)
b = int(b)
res = 0
if a < b:
	res = fact(a)
else:
	res = fact(b)
print(res)


(n, m) = map(int, input().split())
a = 1
if n < m:
	for i in range(1, n + 1):
		a *= i
	print(a)
else:
	for i in range(1, m + 1):
		a *= i
	print(a)


import math
(a, b) = map(int, input().split())
t = min(a, b)
print(math.factorial(t))


def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
(n, m) = map(int, input().split())
ansn = 1
x = min(n, m)
while x != 1:
	ansn = ansn * x
	x = x - 1
print(ansn)


s = input().split(' ')
a = int(s[0])
b = int(s[1])
min = min(a, b)
ans = 1
for i in range(2, min + 1):
	ans *= i
print(ans)


import math
data = [int(i) for i in input().split()]
a = data[0]
b = data[1]
print(math.factorial(min(a, b)))


(a, b) = map(int, input().split())
ans = 1
j = 1
while j <= min(a, b):
	ans = ans * j
	j += 1
print(int(ans))


import math
print(math.factorial(min([int(s) for s in input().split(' ')])))


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

def fac(a):
	i = 1
	for el in range(1, a + 1):
		i *= el
	return i
if n < m:
	print(fac(n))
else:
	print(fac(m))


from itertools import accumulate
import operator
(a, b) = list(map(int, input().split()))
l = [item for item in range(1, min(a, b) + 1)]
acc = accumulate(l, func=operator.mul)
print(list(acc)[-1])


def do(a, b):
	c = 1
	for i in range(2, min(a, b) + 1):
		c *= i
	return c

def main():
	a = list(map(int, input().split()))
	print(do(a[0], a[1]))
main()


import math as m
ar = list(map(int, input().split()))
print(m.factorial(min(ar)))


from sys import stdin
from sys import stdout
(a, b) = [int(x) for x in stdin.readline().split()]

def factorial(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
stdout.write('{}\n'.format(factorial(a if a < b else b)))


def fact(x):
	f = 1
	for i in range(1, x + 1):
		f = f * i
	return f
(x, y) = input().split(' ')
x = int(x)
y = int(y)
z = int((abs(x + y) - abs(x - y)) / 2)
print(fact(z))


import sys
import math
(a, b) = map(int, input().split())
print(math.factorial(min(a, b)))


from sys import stdin
(a, b) = [int(i) for i in stdin.readline().strip().split()]
m = min(a, b)
r = 1
for i in range(1, m + 1):
	r = r * i
print(r)


import sys
(a, b) = map(int, sys.stdin.readline().split())
c = min(a, b)
ans = 1
while c > 0:
	ans *= c
	c -= 1
print(ans)


import sys

def fact(n):
	if n == 1:
		return 1
	else:
		return n * fact(n - 1)
(x, y) = map(int, sys.stdin.readline().strip().split())
if x < y:
	sys.stdout.write(str(fact(x)))
else:
	sys.stdout.write(str(fact(y)))


N = list(map(int, input().split()))
M = min(N)
fact = 1
for i in range(1, M + 1):
	fact *= i
print(fact)


(m, n) = map(int, input().split())
m = min(m, n)
f = 1
for i in range(2, m + 1):
	f *= i
print(f)


import math
m = min(list(map(int, input().split())))
print(math.factorial(m))


import sys, math
(a, b) = list(map(int, sys.stdin.readline().rstrip().split()))
print(math.factorial(min(a, b)))


(a, b) = map(int, input().split())
greater = a if a > b else b
lower = b if b <= a else a
i = lower
r = 1
while i != 1:
	r = r * i
	i -= 1
print(r)


def fac(x):
	if x == 1:
		return 1
	return fac(x - 1) * x
(a, b) = [int(i) for i in input().split()]
print(fac(min(a, b)))


(A, B) = map(int, input().split())
ans = 1
i = 1
while i <= min(A, B):
	ans = ans * i
	i += 1
print(ans)


def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)
(A, B) = map(int, input().split())
if A <= B:
	print(factorial(A))
else:
	print(factorial(B))


def fac(a):
	return 1 if a == 1 else a * fac(a - 1)
print(fac(min(list(map(int, input().split())))))


numlist = [int(x) for x in input().split()]
num_min = min(numlist)
tot = 1
temp = 1
for i in range(1, num_min + 1):
	tot = tot * temp
	temp = temp + 1
print(tot)


from math import gcd
from math import factorial

def bored():
	x = list(map(int, input().split()))
	y = factorial(min(x[0], x[1]))
	if y / max(x):
		print(y)
	else:
		print(gcd(y, max(x)))
bored()


a = input().split()
A = int(a[0])
B = int(a[1])
sum = 1
for i in range(1, min(A, B) + 1):
	sum *= i
print(sum)


import sys

def fact(x):
	if x == 1 or x == 0:
		return 1
	else:
		return x * fact(x - 1)
(a, b) = map(int, sys.stdin.readline().split())
if a < b:
	print(fact(a))
else:
	print(fact(b))


import sys

def main():
	(a, b) = map(int, sys.stdin.readline().split())
	if b < a:
		a = b
	r = 1
	for i in range(2, a + 1):
		r *= i
	print(r)
main()


import math

def main():
	(A, B) = input().split()
	A = int(A)
	B = int(B)
	if A < B:
		print(math.factorial(A))
	else:
		print(math.factorial(B))
main()


import math

def bored(a, b):
	ans = 1
	for i in range(1, min(a, b) + 1):
		ans *= i
	return ans
x = list(map(int, input().rstrip().split()))
a = x[0]
b = x[1]
print(bored(a, b))


import math

class Solution:

	def solution(self):
		(a, b) = map(int, input().strip().split())
		res = math.factorial(min(a, b))
		print(res)
ob = Solution()
ob.solution()


from math import factorial
i = input()
nums = list(map(int, i.split()))
nums[0] = nums[0] if nums[0] < nums[1] else nums[1]
print(factorial(nums[0]))


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

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

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

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

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	(a, b) = map(int, input().split())
	print(fact(min(a, b)))
for _ in range(1):
	solve()


(a, b) = [int(i) for i in input().split(' ')]
ans = 1
j = 1
while j <= min(a, b):
	ans = ans * j
	j = j + 1
print(ans)


def factr(n):
	if n == 0:
		return 1
	return factr(n - 1) * n
(a, b) = map(int, input().split())
l = min(a, b)
print(factr(l))


import math
(a, b) = map(int, input().split())
mn = min(a, b)
print(math.factorial(mn))


import math
x = input()
(a, b) = x.split()
a = int(a)
b = int(b)
r = min(a, b)
print(math.factorial(r))


(n, m) = [int(i) for i in input().split()]
val = min(n, m)
count = 1
while val > 0:
	count *= val
	val -= 1
print(count)


def main():
	from math import factorial
	(a, b) = map(int, input().split(' '))
	return factorial(min(a, b))
print(main())


def factorial(n):
	ans = 1
	for i in reversed(range(1, n + 1)):
		ans *= i
	return ans
(a, b) = list(map(int, input().split()))
print(factorial(min(a, b)))


(a, b) = map(int, input().split(' '))
if a < b:
	i = a - 1
	af = a
	while i > 1:
		af = af * i
		i = i - 1
	print(af)
elif a >= b:
	i = b - 1
	bf = b
	while i > 1:
		bf = bf * i
		i = i - 1
	print(bf)
elif a == 1 or b == 1:
	print('1')


def factorial(n):
	result = 1
	while n > 1:
		result *= n
		n -= 1
	return result
ab = input().split(' ')
a = int(ab[0])
b = int(ab[1])
print(factorial(min(a, b)))


import math
import sys
(a, b) = map(lambda x: int(x), sys.stdin.readline().split())
print(math.factorial(min(a, b)))


(a, b) = input().split()
m = min(int(a), int(b))
ans = 1
for i in range(2, m + 1):
	ans *= i
print(ans)


(a, b) = list(map(int, input().split()))
n = min(a, b)
s = 1
for i in range(1, n + 1):
	s = s * i
print(s)


def fact(n):
	p = 1
	for i in range(2, n + 1):
		p *= i
	return p
(x, y) = map(int, input().split())
print(fact(min(x, y)))


(n, m) = map(int, input().split())
(k, k2, l) = (1, 1, 1)
s2 = min(n, m)
for i in range(1, s2 + 1):
	if i == s2:
		k = k * i
	k2 = k2 * i
print(k2)


def fact(n):
	ret = 1
	for i in range(1, n + 1):
		ret = ret * i
	return ret
inp = input('').split()
lower = int(inp[0]) if int(inp[0]) < int(inp[1]) else int(inp[1])
print(fact(lower))


(a, b) = map(int, input().split())
c = min(a, b)
ans = 1
while c:
	ans *= c
	c -= 1
print(str(ans), end='')


arr = [int(i) for i in filter(None, input().split(' '))]
a = arr[0]
b = arr[1]
fact = 1
if a < b:
	min = a
else:
	min = b
for i in range(min):
	fact *= i + 1
print(fact)


def fact(x):
	cur = 1
	for i in range(1, x + 1):
		cur *= i
	return cur
(x, y) = map(int, input().split())
mini = min(x, y)
print(fact(mini))


import math
inp = list(map(int, input().split()))
if inp[0] < inp[1]:
	aFac = math.factorial(inp[0])
	print(aFac)
	exit()
else:
	bFac = math.factorial(inp[1])
	print(bFac)
	exit()


def Factorial(n):
	fact = 1
	for i in range(1, n + 1):
		fact *= i
	return fact
(A, B) = map(int, input().split(' '))
print(Factorial(min(A, B)))


import math
x = map(int, input().split())
print(math.factorial(min(x)))


import sys
inp = sys.stdin.readline()[:-1].split(' ')
A = int(inp[0])
B = int(inp[1])
ans = 1
mn = min(A, B)
for i in range(2, mn + 1):
	ans = ans * i
print(ans)


def frac(n):
	if n == 1:
		return 1
	else:
		return n * frac(n - 1)
a = input()
a = a.split()
for i in range(0, len(a)):
	a[i] = int(a[i])
if a[0] > a[1]:
	print(frac(a[1]))
else:
	print(frac(a[0]))


(a, b) = map(int, input().split())
answer = 1
user = min(a, b)
while user > 0:
	answer *= user
	user -= 1
print(answer)


def main():
	(n, m) = [int(v) for v in input().split()]
	d = 1
	for i in range(1, min(n, m) + 1):
		d *= i
	print(d)
main()


(a, b) = [int(val) for val in input().split()]
num = min(a, b)
gcd = 1
for i in range(1, num + 1):
	gcd *= i
print(gcd)


(a, b) = input().split()
a = int(a)
b = int(b)
t = a
if b < a:
	t = b
n = 1
ans = 1
while n <= t:
	ans = ans * n
	n = n + 1
print(ans)


def fact(a):
	if a == 0:
		f = 1
	else:
		f = a * fact(a - 1)
	return f
(x1, x2) = map(int, input().split())
a1 = min(x1, x2)
print(fact(a1))


import math
(a, b) = map(int, input().split())
if a == 1 or b == 1:
	print(1)
elif a == b:
	print(math.factorial(a))
else:
	m = min(a, b)
	print(math.factorial(m))


def factorial(n):
	value = 1
	if n <= value:
		return value
	for x in range(2, n + 1):
		value *= x
	return value

def main():
	import sys
	for line in sys.stdin:
		line = [int(x) for x in line.rstrip().split(' ')]
		a = line[0]
		b = line[1]
		print(factorial(min(line)))
main()


(a, b) = map(int, input().strip().split())
counter = 1
if a < b:
	c = a
elif a >= b:
	c = b
for i in range(c):
	counter = counter * (i + 1)
print(counter)