#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int min_ = min(a, b);
  int p = 1;
  for (int i = 1; i <= min_; i++) {
    p = p * i;
  }
  cout << p << '\n';
}
