#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vii = vector<int>;
using vll = vector<ll>;
template <class T>
using vv = vector<T>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
void show(const vector<T> &a) {
  for (int i = 0; i < (int)a.size(); ++i)
    cout << a[i] << (i != (int)a.size() - 1 ? " " : "\n");
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int dy[] = {0, 1, -1, 0};
int dx[] = {1, 0, 0, -1};
int a, b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  ll ans = 1;
  for (int i = 1; i <= min(a, b); i++) {
    ans *= i;
  }
  cout << ans << endl;
  return 0;
}
