#include <bits/stdc++.h>
using namespace std;
int fac(int x) {
  int ans = 1;
  for (int i = 2; i <= x; i++) {
    ans *= i;
  }
  return ans;
}
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) != -1) {
    int c = min(a, b);
    c = fac(c);
    printf("%d\n", c);
  }
  return 0;
}
