#include <bits/stdc++.h>
using namespace std;
string s;
long long a[10001];
long long i, j, k = 1, l, r, c, n, m;
stack<char> q;
char ch;
int main() {
  cin >> n >> m;
  for (int i = 2; i <= min(n, m); i++) k *= i;
  cout << k;
}
