#include <bits/stdc++.h>
using namespace std;
int fac[12] = {1,    2,     6,      24,      120,      720,
               5040, 40320, 362880, 3628800, 39916800, 479001600};
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  int ans = min(a, b);
  printf("%d\n", fac[ans - 1]);
  return 0;
}
