#include <bits/stdc++.h>
using namespace std;
constexpr double pi = 3.141592653589793238462643383279502884L;
const int sz = 1e5;
int main() {
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  a = min(a, b);
  long long int ans = 1;
  for (int i = 1; i <= a; ++i) {
    ans *= i;
  }
  cout << ans << endl;
}
