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