#include<bits/stdc++.h>
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
#define fill(x,y) memset(x, y, sizeof(x))
#define trace(x) cout << #x << " = " << x << endl
#define bug cout << "Bug check" << endl
#define endl '\n'
using namespace std;
int main(){
//freopen("in.txt","r", stdin);
//freopen("out.txt","w", stdout);
//ios::sync_with_stdio(0);
//cin.tie(0);
long long n; cin >> n;
vector <int> v;
if(n==1){
cout << "1" << endl;
return 0;
}
else if(n==0){
cout << "10" << endl;
return 0;
}
for(int i=9;i>=2;i--){
while(n%i==0){
n=n/i;
v.push_back(i);
}
}
if(n==1){
for(int i = v.size()-1; i>=0 ; i--){
cout << v[i];
}
cout << endl;
}
else{
cout << "-1" << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCiNkZWZpbmUgICAgcGkgICAgICAgICAgYWNvcygtMSkgCiNkZWZpbmUgICAgYWxsKHgpICAgICAgKHgpLmJlZ2luKCksKHgpLmVuZCgpCiNkZWZpbmUgICAgZmlsbCh4LHkpICAgbWVtc2V0KHgsIHksIHNpemVvZih4KSkKI2RlZmluZSAgICB0cmFjZSh4KSAgICBjb3V0IDw8ICN4IDw8ICIgPSAiIDw8IHggPDwgZW5kbAojZGVmaW5lICAgIGJ1ZyAgICAgICAgIGNvdXQgPDwgIkJ1ZyBjaGVjayIgPDwgZW5kbAojZGVmaW5lICAgIGVuZGwgICAgICAgICdcbicKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewoJLy9mcmVvcGVuKCJpbi50eHQiLCJyIiwgc3RkaW4pOwoJLy9mcmVvcGVuKCJvdXQudHh0IiwidyIsIHN0ZG91dCk7CiAKCS8vaW9zOjpzeW5jX3dpdGhfc3RkaW8oMCk7CgkvL2Npbi50aWUoMCk7Cglsb25nIGxvbmcgbjsgY2luID4+IG47CgkKCXZlY3RvciA8aW50PiB2OwoKCWlmKG49PTEpewoJCWNvdXQgPDwgIjEiIDw8IGVuZGw7CgkJcmV0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