#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
int a[3]={2,3,5};
int main()
{
priority_queue<LL,vector<LL>, greater<LL> >q;
set<LL>s;
q.push(1);
s.insert(1);
for(int i=1;;i++)
{
LL ans=q.top();
q.pop();
if(i==1500)
{
cout<<"The 1500'th ugly number is "<<ans<<"."<<endl;
break;
}
for(int j=0;j<3;j++)
{
LL x=ans*a[j];
if(s.count(x)==0)
{
q.push(x);
s.insert(x);
}
}
}
return 0;
}