#include <bits/stdc++.h>
using namespace std;
const int arr = 9e5 + 10;
signed main() {
  long long a, b;
  cin >> a >> b;
  a = min(a, b);
  long long ans = 1;
  for (long long i = 1; i <= a; i++) ans *= i;
  cout << ans;
}
