#include <bits/stdc++.h>
using namespace std;
long long int fact(int n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return fact(n - 1) * n;
}
int main() {
  int a, b;
  cin >> a >> b;
  if (a > b)
    cout << fact(b);
  else
    cout << fact(a);
  return 0;
}
