#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, prod = 1;
  vector<long long int> factorials = {
      1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600};
  cin >> a >> b;
  if (a <= b)
    cout << factorials[a - 1];
  else
    cout << factorials[b - 1];
  return 0;
}
