#include <bits/stdc++.h>
using namespace std;
int factorial(int a) { return a < 1 ? 1 : a * factorial(a - 1); }
int main() {
  int A, B;
  cin >> A >> B;
  cout << factorial(min(A, B)) << endl;
  return 0;
}
