#include <bits/stdc++.h>
using namespace std;
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<int> v;
  long long t, i, j, l, te, n, a, b, x, y, flag;
  cin >> a >> b;
  te = min(a, b);
  cout << factorial(te);
  return 0;
}
