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