#include <bits/stdc++.h>
using namespace std;
vector<bool> isprime(1000007 + 1, true);
int small[1000007 + 1];
void sieve() {
  isprime[0] = isprime[1] = 0;
  int i, j;
  for (i = 4; i <= 1000007; i += 2) isprime[i] = 0;
  for (i = 3; i <= 1000; i += 2)
    if (isprime[i])
      for (j = i * i; j <= 1000007; j += (i + i)) isprime[j] = 0;
}
void smallprime() {
  int i, j;
  small[0] = small[1] = 0;
  for (i = 2; i <= 1000007; i++) small[i] = (i & 1) ? i : 2;
  for (i = 3; i <= 1000; i += 2)
    if (small[i] == i)
      for (j = i << 1; j <= 1000007; j += i)
        if (small[j] == j) small[j] = i;
}
void fact(long long int n) {
  long long int temp = small[n], prod = 1, count = 0;
  while (n > 1) {
    if (temp == small[n])
      count++;
    else {
      cout << temp << "^" << count << " ";
      prod *= (count + 1);
      temp = small[n];
      count = 1;
    }
    n /= small[n];
  }
  cout << temp << "^" << count << " " << endl;
  prod *= (count + 1);
}
inline bool ispalin(vector<int> s) {
  for (int i = 0, j = s.size() - 1; i <= j; i++, j--)
    if (s[i] != s[j]) return false;
  return true;
}
inline bool ispalin(string s) {
  for (int i = 0, j = s.size() - 1; i <= j; i++, j--)
    if (s[i] != s[j]) return false;
  return true;
}
inline bool ispalin(int s) {
  int k = s;
  int num = 0;
  while (k) {
    num *= 10;
    num += k % 10;
    k /= 10;
  }
  if (num == s)
    return 1;
  else
    return 0;
}
inline long long int gcd(long long int a, long long int b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
inline long long int modexp(long long int a, long long int b, long long int m) {
  long long int d = 1;
  while (b > 0) {
    if (b & 1) d = (d * a) % m;
    a = (a * a) % m;
    b = b >> 1;
  }
  return (d < 0 ? d + m : d);
}
inline bool isPrime(long long int x) {
  for (long long int a = 2; a * a <= x; ++a)
    if (x % a == 0) return false;
  return true;
}
inline long long int powf(long long int a, long long int b) {
  long long int d = 1;
  while (b > 0) {
    if (b & 1) d = d * a;
    a = (a * a);
    b = b >> 1;
  }
  return d;
}
inline int digsum(long long int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
long long int ncr(long n, long r) {
  vector<vector<long> > dp(2, vector<long>(r + 1, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < (((i) < (r)) ? (i) : (r)); j++)
      dp[i & 1][j] =
          ((i == j || j == 0)
               ? 1
               : (dp[(i - 1) & 1][j] + dp[(i - 1) & 1][j - 1]) % 1000000007);
  return dp[n & 1][r];
}
long long int ncr2(long n, long r) {
  long long int ans = 1;
  for (long i = n; i > r; i--) ans = (ans * i) % 1000000007;
  for (int i = 0; i < n - r; i++)
    ans = (ans * (modexp(i, 1000000007 - 2, 1000000007))) % 1000000007;
  return ans;
}
long phi(long long int n) {
  long long int ret = n;
  long long int i = 2;
  if (n % i == 0) {
    ret -= ret / i;
    while (n % i == 0) n /= i;
  }
  for (i = 3; i * i <= n; i++)
    if (n % i == 0) {
      ret -= ret / i;
      while (n % i == 0) n /= i;
    }
  if (n > 1) ret -= ret / n;
  return ret;
}
long phi2(long long int n) {
  if (n == 1) return 1;
  long long int temp = small[n], count = n;
  while (n > 1) {
    if (temp != small[n]) {
      count -= count / temp;
      temp = small[n];
    }
    n /= small[n];
  }
  count -= count / temp;
  return count;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  {
    int fact = 1;
    long long int a, b;
    cin >> a >> b;
    ;
    if (a > b) {
      for (int i = 1; i <= b; i++) fact *= i;
    } else {
      {
        for (int i = 1; i <= a; i++) fact *= i;
      }
    }
    cout << fact << endl;
  }
  return 0;
}
