#include<iostream> #include<cmath> #include<cstdio> #include<algorithm> #include<cstring> #include<string> #include<stack> #include<queue> #include<map> #include<cstdlib> #include<set> #include<ctime> #include<vector> #include<cstdio> #include<list> #include<sstream> //#include<regex> using namespace std; typedef long long ll; int INF=2147483647; int inf=-2147483648; #define read(x) scanf("%d",&x); #define fo(i,n) for(int i=0;i<(n);i++) #define me(a) memset(a,0,sizeof(a)); #define one(x) cout<<(x)<<endl; #define two(a,b) cout<<(a)<<" "<<(b)<<endl; #define three(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl; #define four(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl; //int dir[4][2]={-1,0,1,0,0,-1,0,1}; //int dir[8][2]={-1,0,1,0,0,-1,0,1,-1,-1,1,1,1,-1,-1,1}; //int dir[4][2]={-2,0,2,0,0,-2,0,2}; const int dir[3]={2,3,5}; int main() { set<ll>q; priority_queue<ll,vector<ll>,greater<ll> >p; p.push(1); q.insert(1); for(int i=1;;i++){ ll x=p.top(); p.pop(); if(i==1500){ cout<<x<<endl; break; } for(int i=0;i<3;i++){ ll xx=x*dir[i]; if(!q.count(xx)){ q.insert(xx); p.push(xx); } } } }