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