#include <bits/stdc++.h>
using namespace std;
long long ans;
int a, b;
int main() {
  cin >> a >> b;
  int c = min(a, b);
  ans = 1;
  for (int i = 1; i <= c; i++) ans *= i;
  cout << ans;
  return 0;
}
