#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

void factorial(int n){
	int fact[10] = {0};
	fact[0] = 1;
	for(int i=1; i<=n; i++){
		REP(j, 10){
			fact[j] *= i;
		}
		REP(j, 9){
			fact[j+1] += fact[j] / 10000;
			fact[j] -= (fact[j] / 10000) * 10000;
		}
	}
	int i;
	for(i=9; i >= 0; i--) {
		if (fact[i] != 0) {
			printf("%d", fact[i]);
			i--;
			break;
		}
	}
	while (i >= 0) {
		printf("%04d", fact[i]);
		i--;
	}
	cout << endl;
}

int main(){
    int n;
    cin >> n;
    factorial(n);
}
