import java.util.*; public class Main { static boolean isUgly(int j ){ boolean result=false; while(j!=1 ){ if(j % 2 ==0 && j!=1){ j=j/2; }else if (j % 3 ==0 && j!=1){ j=j/3; }else if (j % 5 ==0 && j!=1){ j=j/5; }else{ result=false; break; } if(j==1){ result=true; break; } //j++; } return result; } public static void main (String[] args){ //Test a=new Test(); Scanner s=new Scanner(System.in); int n=s.nextInt(); //n=100; int j=2; int count=0; int max=10000; int b=n-1; while(count!=b && j<max ){ if( isUgly(j)){ //System.out.println("Ugly : " + j); count++; }; if(count==b){ break; } j++; } //System.out.println("Output : " + j); System.out.println( j); } }
A = int(input()) dic = dict((i,i) for i in range(1, 7)) n = 7 k = 7 if A <= 6: print(A) else: while k <= A: num = n while num != 1: if num % 2 == 0: num = num // 2 elif num % 3 == 0: num = num // 3 elif num % 5 == 0: num = num // 5 else: n += 1 break if num in dic.values() or num == 1: dic[k] = n k += 1 n += 1 break print(dic[A])