#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 29);
const int INFF = 0x7fffffff;
const long long LINF = (1ll << 60);
const long long LINFF = +0x7fffffffffffffff;
const long double PI = 3.14159265359;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rnd(long long a, long long b) {
  return uniform_int_distribution<long long>(a, b)(rng);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  cin >> a >> b;
  long long c = min(a, b);
  long long val = 1;
  for (long long i = 1; i <= c; i++) val *= i;
  cout << val << '\n';
  return 0;
}
