#include<bits/stdc++.h>
using namespace std;
const int sv[10] = {6,2,5,5,4,5,6,3,7,6};
long long ans = 0;
vector<int> v;
/*bool valid(int n,int a){
    int sum = 0;
    while(a>0){
        sum+= sv[a%10];
        a/=10;
    }
    if(sum == n){
        return true;
    }
    return false;
}
*/
int finder(int n){
    int a = -1;
    for(int i = 0; i < v.size(); i++){
        //if(!valid(n,v[i])){
           // continue;
        //}
        a = max(a,v[i]);
    }
    return a;
}
void gen(int n){
    //cout<<"n  = " << n <<endl;
    if(n == 0){
        v.push_back(ans);
        ans = 0;
        return;
    }
    for(int i = 0; i < 10 ; i++){
        //cout<<"za i =  " << i << " n = "<< n<<endl ;
        if(n-sv[i] >= 0){
            //cout<<" push back:" << i <<endl;
            //cout<<n<<" "<<"sv"<<sv[i]<<endl;
            ans = 10*ans + i;
            gen(n-sv[i]);
        }
    }
    ans/=10;
    return;
}
int main(){
    int n;
    cin>>n;
    gen(n);
    cout<<finder(n);
}
