#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001


int main(){
	int a,b;
	cin>>a>>b;
	
	a |= b;
	
	long long ans = 1LL;
	
	rep(i,a)ans *= i+1;
	
	cout<<ans<<endl;
	
	
	return 0;
}