#include <bits/stdc++.h>
using namespace std;
int input() {
  int res = 0;
  char c = ' ';
  while (c < '0') c = getchar();
  while (c >= '0') res = res * 10 + (c - '0'), c = getchar();
  return res;
}
const int N = 1e5 + 1;
long long fact[N];
int main() {
  fact[1] = 1;
  for (long long i = 2; i <= 13; ++i) fact[i] = fact[i - 1] * i;
  long long a, b;
  cin >> a >> b;
  cout << fact[min(a, b)];
}
