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