#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int m = min(a, b);
  long long f = 1;
  for (int i = 1; i <= m; i++) {
    f = f * i;
  }
  cout << f << endl;
}
