#include<iostream>
using namespace std;
int a,b;
int main(){
cin>>a>>b;
a=a<b?a:b;
for(b=a;–a;)b*=a;
cout<<b;
}