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