#include<bits/stdc++.h> using namespace std; int main(){ int n;long long s=1; cin>>n; for(int i=1;i<=n;i++)s*=i; while(s>0){ if(s%10>0){ cout<<s%10; return 0; } s/=10; } return 0; }