#include <bits/stdc++.h>
using namespace std;
string s;
int fun(int x) {
  if (x <= 1) {
    return 1;
  } else {
    return x * fun(x - 1);
  }
}
int main() {
  int a, b;
  cin >> a >> b;
  int x = min(a, b);
  int l = fun(x);
  cout << l << endl;
  return 0;
}
