#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, temp;
  cin >> a >> b;
  temp = min(a, b);
  int fact = 1;
  for (int i = 1; i <= temp; i++) fact = fact * i;
  cout << fact << "\n";
  return 0;
}
