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