#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, fact = 1, i, j, ft = 1, m, x;
  cin >> n >> m;
  int mn = min(n, m);
  for (i = 1; i <= mn; i++) {
    ft *= i;
  }
  cout << ft << endl;
  return 0;
}
