#include <bits/stdc++.h>
int main() {
  long long int a, b, sum, i, max;
  while (~scanf("%lld%lld", &a, &b)) {
    sum = 1;
    if (a <= b) {
      max = a;
    } else
      max = b;
    for (i = 1; i <= max; i++) {
      sum *= i;
    }
    printf("%lld\n", sum);
  }
  return 0;
}
