#include <bits/stdc++.h>
using namespace std;
long long fac(long long a) {
  if (a == 1)
    return 1;
  else
    return a * fac(a - 1);
}
int main(int argc, char const *argv[]) {
  long long a, b;
  cin >> a >> b;
  if (a < b)
    cout << fac(a);
  else
    cout << fac(b);
  return 0;
}
