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