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