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