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