#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  scanf("%lld%lld", &a, &b);
  c = min(a, b);
  long long k = c == 0 ? 0 : 1;
  for (int i = c; i > 0; i--) k = k * i;
  printf("%lld\n", k);
  return 0;
}
