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