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