#include <bits/stdc++.h>
using namespace std;
int factorial(int n) {
  if (n <= 1) {
    return 1;
  }
  return n * factorial(n - 1);
}
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  int sf = min(a, b);
  int af = factorial(sf);
  printf("%d\n", af);
  return 0;
}
