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