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