Drazil is playing a math game with Varda.

Let's define <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/7020b94c48be2ee5b8eeca05f379c8911bb0e7c4.png" style="max-width: 100.0%;max-height: 100.0%;"/> for positive integer *x* as a product of factorials of its digits. For example, <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/6784d861d9a724d0aeddefcb00b7d0c3442ae586.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

First, they choose a decimal number *a* consisting of *n* digits that contains at least one digit larger than 1. This number may possibly start with leading zeroes. Then they should find maximum positive number *x* satisfying following two conditions:

1. *x* doesn't contain neither digit 0 nor digit 1.

2. <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/7020b94c48be2ee5b8eeca05f379c8911bb0e7c4.png" style="max-width: 100.0%;max-height: 100.0%;"/> = <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/aa57e017a6c74d06b0a54bc47e3f6990e5af38c1.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

Help friends find such number.
The first line contains an integer *n* (1 ≤ *n* ≤ 15) — the number of digits in *a*.

The second line contains *n* digits of *a*. There is at least one digit in *a* that is larger than 1. Number *a* may possibly contain leading zeroes.
//*****************************************************************************
//*     __      ________        __________         __________      __      __ *
//*    |  |    |        |      ||_________|       ||________|      ||      || *
//*    |  |    |        |      ||                 ||               ||      || *
//*    |  |    |________|      ||                 ||               ||      || *
//*    |  |    |________|      ||     ______      ||      ______   ||      || *
//* ___|  |    |        |      ||____| | | |      ||_____| | | |   ||______|| *
//*|______|    |        |      ||______| |_|      ||_______| |_|   ||______|| *
//*                                                                           *
//******************************************************************************
#include<bits/stdc++.h> 

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")

using namespace std; 
typedef long long ll; 
typedef long double ld; 
typedef pair<ll, ll> pll;

const long long high_min = (long long)-1e18;
const long long high_max = (long long)1e18;
const long long low_min = (long long)-1e9;
const long long low_max = (long long)1e9;
const long long MOD = ll(1e9+7);

using vi = vector<long long int>;
using vpi = vector<pair<long long int,long long int>>;
using vs = vector<string>;
using umi = unordered_map<long long int,long long int>;
using vm = unordered_map<long long int, bool>;
using mapi = map<long long int,long long int>;

#define f(i,a,b) for(ll i=a;i<b;i++) 
#define prnt(a) for(auto _:a) {cout<<_<<' ';}cout<<endl; 
#define prnt_map(a) for(auto x : a) {cout<<x.first<<' '<<x.second; cout<<endl;} 
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower) 
#define upper(a) transform(a.begin(),a.end(),a.begin(),::toupper) 
#define int long long 
#define umap unordered_map
#define vec_read(x) for(auto &i:x) cin>>i;; 
#define mp make_pair 
#define mt make_tuple 
#define eb emplace_back  
#define pb push_back 
#define min_(a) *min_element(a.begin(),a.end()) 
#define max_(a) *max_element(a.begin(),a.end()) 
#define all(a) a.begin(),a.end() 
#define se second 
#define fi first 
#define len(a) (long long )a.size()
#define si(x) int(x.size()) 
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cout << vars << " = ";
    string delim = "";
    (..., (cout << delim << values, delim = ", "));
    cout<<endl;
}
template<typename... T> 
void read(T&... args) {
    ((cin>>args), ...); 
} 
template<typename... T> 
void print(T... args) { //rvalue reference is new to C++ 
    ((cout<<args<<' '), ...); 
    cout<<endl; 
}
int msb(int N) {
    return N ? 32 - __builtin_clzll(N) : -MOD;
}
int pow(int a, int n){
    if (n<1) return 1;
    int value = pow(a,n/2);
    if (n%2) return (value*value*a)%MOD;
    else return (value*value)%MOD;
}
int min(int a, int b){
	return a>b? b:a;
}
int max(int a, int b){
	return a<b? b:a;
}
//....................................

vector<string> numbers{"","","2","3","223","5","35","7","2227","3327"};
// 7777553333222222222222

int fact(string s){
    int val = 1;
    for(auto i : s){
        for(int j=2;j<=i-'0';j++) val*=j;
    }
    return val;
}
void solve(){  
    int n;string a; cin>>n>>a;
    string s="";
    print(fact(a),a);
    for(auto i:a){
        s+=numbers[i-'0'];
    }    
    print(fact(s));
    print(s);
    sort(all(s),greater());
    print(s);

} 
void test_case(){ 
    int testCase; 
    cin>>testCase;
    while(testCase--) solve();
} 
int32_t main() { 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    // test_case(); 
    solve(); 
    return 0; 
}


