#include <bits/stdc++.h>
unsigned long long int factorial(unsigned long long int n) {
  unsigned long long int facto;
  if (n == 0) return 1;
  return facto = n * factorial(n - 1);
}
int main() {
  long long int a, b, GCD;
  unsigned long long int fa, fb;
  scanf("%I64d %I64d", &a, &b);
  if (a > b) {
    fb = factorial(b);
    printf("%I64d\n", fb);
  } else {
    fa = factorial(a);
    printf("%I64d\n", fa);
  }
  return 0;
}
