// ACM.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<stdio.h>
#define M 5843
long a[M+4];
long min(long x,long y)
{
if(x<=y)return x;
else
return y;
}
void choose()
{
int i,i1,i2,i3,i4;
long t1,t2,t3,t4;
a[0]=1;
i1=0;i2=0;i3=0;i4=0;
for(i=1;i<M;i++) //很好用的打表技巧呢!
{
t1=a[i1]*2; //对于表中的每一项,都乘以对应的素数,就不会漏掉数字了。^l^
t2=a[i2]*3;
t3=a[i3]*5;
t4=a[i4]*7;
a[i]=min(min(t1,t2),min(t3,t4));
if(a[i]==t1)i1++;
if(a[i]==t2)i2++;
if(a[i]==t3)i3++;
if(a[i]==t4)i4++; //这里可不能用else,t1,t2,t3,t4可能相等的哦。
}
}
int main()
{
int n,temp,st;
choose();
while(scanf("%d",&n),n)
{
temp=n%100;
st=temp%10;
if(st==1&&(temp!=11))
{
printf("The %dst humble number is %ld./n",n,a[n-1]);
}
else
if(st==2&&temp!=12)
{
printf("The %dnd humble number is %ld./n",n,a[n-1]);
}
else
if(st==3&&temp!=13)
{
printf("The %drd humble number is %ld./n",n,a[n-1]);
}
else
printf("The %dth humble number is %ld./n",n,a[n-1]);
}
return 0;
}