#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, lim, a, b, gcd = 1;
  cin >> a >> b;
  lim = min(a, b);
  for (i = 2; i <= lim; i++) {
    gcd *= i;
  }
  cout << gcd << endl;
  return 0;
}
