/*   @JUDGE_ID:   1705PZ   443   C */
#include <math.h>
#include <stdio.h>

int main(){
int count = 1,num;
int i,j,k,l;
int m = 0,n = 0,o = 0,p = 0;
int next2,next3,next5,next7;
int ans[5842][4];
float temp,next;
double answer;
ans[0][0] = 0;
ans[0][1] = 0;
ans[0][2] = 0;
ans[0][3] = 0;
num = 5842;
while(count != num){
   next = 2;
   for(i = -m;pow(2,i) / (pow(3,n) * pow(5,o) * pow(7,p)) <= next;i++)
      for(j = -n;(pow(2,i) * pow(3,j)) / (pow(5,o) * pow(7,p)) <= next;j++)
	 for(k = -o;pow(2,i) * pow(3,j) * pow(5,k) / pow(7,p)<= next;k++)
	    for(l = -p,temp = pow(2,i) * pow(3,j) * pow(5,k) * pow(7,l);temp <= next;l++,temp *= 7)
	       if(temp > 1){
	       next = temp;
	       next2 = i;
	       next3 = j;
	       next5 = k;
	       next7 = l;
	       }
   m += next2;
   n += next3;
   o += next5;
   p += next7;
   ans[count][0] = m;
   ans[count][1] = n;
   ans[count][2] = o;
   ans[count][3] = p;
   count++;
   }
while(scanf("%d",&i) == 1){
   if(i == 0)
      break;
   answer = pow(2,ans[i - 1][0]) * pow(3,ans[i - 1][1]) * pow(5,ans[i - 1][2]) * pow(7,ans[i - 1][3]);
   if(i % 10 == 1 && i % 100 != 11)
      printf("The %dst humble number is %.0lf.\n",i,answer);
   else if(i % 10 == 2 && i % 100 != 12)
      printf("The %dnd humble number is %.0lf.\n",i,answer);
   else if(i % 10 == 3 && i % 100 != 13)
      printf("The %drd humble number is %.0lf.\n",i,answer);
   else
      printf("The %dth humble number is %.0lf.\n",i,answer);
   }
return 0;
}
@END_OF_SOURCE_CODE
