#include <bits/stdc++.h>
using namespace std;
int jiecheng(int x) {
  if (x == 1)
    return 1;
  else
    return x * jiecheng(x - 1);
}
int main() {
  int A, B;
  cin >> A >> B;
  if (A > B)
    cout << jiecheng(B);
  else
    cout << jiecheng(A);
}
