#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int c2,c3,c5,c7;int min(int a,int b,int c,int d){ if(a<=b&&a<=c&&a<=d) { c2++; return a; } if(b<=a&&b<=c&&b<=d) { c3++; return b; } if(c<=b&&c<=a&&c<=d) { c5++; return c; } if(d<=b&&d<=c&&d<=a) { c7++; return d; }}int main(void){ c2=c3=c5=c7=1; int num[5847]; num[1] = 1; int count =1; while(count<=5843) { count++; num[count]=min(2*num[c2],3*num[c3],5*num[c5],7*num[c7]); if(num[count] == 2*num[c2]) c2++; if(num[count] == 3*num[c3]) c3++; if(num[count] == 5*num[c5]) c5++; if(num[count] == 7*num[c7]) c7++; }int n;while(cin>>n){ if(!n) break; printf("The %d",n); if(n%100/10==1) printf("th humble number is %d.n",num[n]); else if(n%10==1) { printf("st humble number is %d.n",num[n]); } else if(n%10==2) { printf("nd humble number is %d.n",num[n]); } else if(n%10==3) { printf("rd humble number is %d.n",num[n]); } else { printf("th humble number is %d.n",num[n]); }}return 0;}