#include <bits/stdc++.h>
using namespace std;
unsigned long long Factorial(unsigned long long a) {
  unsigned long long A = 1;
  for (unsigned long long i = a; i > 1; i--) A *= i;
  return A;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  cout << Factorial(min(a, b)) << '\n';
  return 0;
}
