#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) {
    long long int a, b, res = 1, res1 = 1;
    cin >> a >> b;
    if (a > b) {
      for (int i = 2; i <= b; i++) {
        res1 = res1 * i;
      }
      cout << res1;
    } else {
      for (int i = 2; i <= a; i++) {
        res = res * i;
      }
      cout << res;
    }
  }
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
