#include <bits/stdc++.h>
using namespace std;
const int MX = 2 * 1e5 + 10;
const double PI = acos(-1.0), EPS = 1e-9;
int main() {
  long long a, b;
  cin >> a >> b;
  long long m = (min(a, b));
  long long bbb = 1;
  for (long long i = 1; i <= m; i++) bbb *= i;
  cout << bbb;
  return 0;
}
