#include <bits/stdc++.h>
using namespace std;
int main() {
  long long fact1 = 1, i, c, s;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> c >> s;
  c = min(c, s);
  for (i = c; i >= 2; i--) fact1 = fact1 * i;
  cout << fact1;
}
