#include <bits/stdc++.h>
using namespace std;
int fac(int n) {
  if (n <= 1) {
    return 1;
  } else
    return n * fac(n - 1);
}
int main() {
  int x, y;
  cin >> x >> y;
  if (x <= y)
    cout << fac(x);
  else
    cout << fac(y);
}
