#include <bits/stdc++.h>
using namespace std;
unsigned long long factorial(unsigned long long number);
int main() {
  unsigned long long A, B;
  cin >> A >> B;
  cout << factorial(min(A, B));
  return 0;
}
unsigned long long factorial(unsigned long long number) {
  unsigned long long sum = 1;
  for (int i = 2; i <= number; i++) {
    sum *= i;
  }
  return sum;
}
