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