#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;
}