public class main{
public long countPrimes(int n) {
long sum = 1;
int n2 = 0;
boolean[]arr = new boolean [10000000+1];
for(int i = 2 ;i < 10000000+1 ;i++) {
int j = 2;
if(arr[i]!=true)
while(j * i < 10000000+1 ) {
arr[j * i ] = true;
j++;
}
}
for(int i = 2 ;i< 10000000+1 ;i++) {
if(arr[i] != true) {
sum = (sum*i)%50000;
n2 ++ ;
}
if(n2 >= n)
break;
}
return sum;
}
public static void main(String[]args) {
Main1 m = new Main1 ();
Scanner sc = new Scanner (System.in);
int n = sc.nextInt();
System.out.println(m.countPrimes(n));
}
}