#include <bits/stdc++.h>
using namespace std;
long long fact(long long a) {
  int facto = 1, i;
  for (i = 2; i <= a; i++) facto *= i;
  return facto;
}
int main() {
  long long a, b;
  cin >> a >> b;
  long long t = min(a, b);
  cout << fact(t);
}
