#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  if (n == 1) return 1;
  return fact(n - 1) * n;
}
int main() {
  long long num, tc, t = 0, a, b;
  scanf("%lld %lld", &a, &b);
  long long small = min(a, b);
  cout << fact(small) << endl;
  return 0;
}
