#include <string.h> #include <stdio.h> #include <iostream> #include <vector>#include <algorithm> using namespace std; string str; string temp; int num(string a,int b){ string c; int k = 0,i; for(i = 0;i < a.size(); i++) { k *= 10; k += a[i]-'0'; if(k/b||k/b==0&&c.size()) c+=k/b+'0'; k%=b; } temp = c; return k; } bool solve(string a) { int i; for(i = 9; i >= 2; i--) { while(num(a,i)==0) { str += i+'0'; a = temp; } } if(a=="1") return true; return false; } main() { string a; while(cin>>a,a!="-1") { if(a=="0"||a=="1") { cout<<"1"<<a<<endl; continue; } str = ""; if(solve(a)) { reverse(str.begin(),str.end()); if(str.size()==1) cout<<"1"; cout<<str<<endl; } else cout<<"There is no such number."<<endl; } }