#include <bits/stdc++.h>
int fact(int n) {
  if (n <= 1)
    return 1;
  else
    return n * fact(n - 1);
}
int main() {
  int a, b, x, y, i;
  scanf("%d %d", &a, &b);
  int n;
  if (a > b)
    n = b;
  else
    n = a;
  printf("%d\n", fact(n));
  return 0;
}
