#include<bits/stdc++.h>
using namespace std;
#define zhalok Zhalok
#define inf 100000.0
#define ll long long int
#define ull unsigned long long
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define negloop(i,a,b) for(ll i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vull vector<ull>
#define pb push_back
#define be begin()
#define en end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define MOD 1000000007
#define sz 200000

ll cill(ll a,ll b)
{
	if(a%b==0)
	return a/b;
	return a/b+1;
	}

ll maxx(ll a,ll b)
{
	return a>b?a:b;
}

ll minn(ll a,ll b)
{
	return a<b?a:b;
}

vll take_input(ll n)
{
	vll v;
//	v.pb(0);
	loop(i,0,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

vi take_input(int n)
{
	vi v;
	v.pb(0);
	loop(i,0,n)
	{
		int x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

void print(vll v)
{
	loop(i,0,v.size())
	cout<<v[i]<<" ";
	cout<<endl;
}

void print(vpll pairs)
{
	for(int i=0;i<pairs.size();i++) cout<<pairs[i].ff<<" "<<pairs[i].ss<<endl;
}

vll num_to_vect(ll n)
{
	vll v,temp;
	v.pb(0);
	while(n)
	{
		temp.pb(n%10);
		n/=10;
	}
	reverse(temp.begin(),temp.end());
	loop(i,0,temp.size())
	v.pb(temp[i]);
	return v;
 }

ll odd_n(ll n)
{
	return (n-1)/2+1;
}

	int gcd(int a ,int b)
	{
		if(a%b==0)
		return b;
		return gcd(b,a%b);
	}

ll get_min(vll v)
{
	ll mn=inf;
	loop(i,0,v.size())
	mn=minn(mn,v[i]);

	return mn;
}

void printt(vi v)
{
	loop(i,0,v.size()) cout<<v[i]<<" "; cout<<endl;
}

int bin_to_dec(string bin)
{
	int sum=0;
	for(int i=0;i<bin.size();i++)
	{
		sum*=10;
		sum+=(bin[i]-'0');

	}
	return sum;
}

double find_dis(pair <double,double> p1,pair <double,double> p2)
{
	return sqrt((p1.ff-p2.ff)*(p1.ff-p2.ff)+(p1.ss-p2.ss)*(p1.ss-p2.ss));
}

/*vll v;

ll ans;

void merge(int l,int r)
{
	int mid=(l+r)/2;
	vll temp(r-l+1,0);
	int i=l;
	int j=mid+1;
    int k=0;
	while(i<=mid&&j<=r)
	{
		if(v[i]<=v[j]) temp[k++]=v[i++];
		else
		{
			ans+=abs(k-(j-l));
			temp[k++]=v[j++];
		}
	}
	while(i<=mid) temp[k++]=(v[i++]);
	while(j<=r) temp[k++]=(v[j++]);

	for(int i=0,k=l;i<temp.size(),k<=r;i++,k++)
	v[k]=temp[i];

}

void mergesort(int l,int r)
{
	if(l>=r) return ;
    else
    {
    	int mid=(l+r)/2;
    	mergesort(l,mid);
    	mergesort(mid+1,r);
    	merge(l,r);
	}
}

*/

//*************************************

//*********************************************************

// the code starts here ...

ll how_many_substring(string s,string sub)
{
	ll cnt=0;
	loop(i,0,(s.size()-sub.size())+1)
	{
		bool flag=true;
		for(int k=i,j=0;j<sub.size();j++,k++)
		if(s[k]!=sub[j])
		{
			flag=false;
			break;
		}
		if(flag)
		cnt++;
	}
	return cnt;
}

vi v;

int find_ans(int lo,int hi)
{
	if(lo==hi) return v[lo];

	int mid=(lo+hi)/2;
	int left=find_ans(lo,mid);
	int right=find_ans(mid+1,hi);
	return max(max(left,right),left^right);
}

ll abss(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a;
}

ll mod_exp(ll a,ll n,ll mod)
{
	if(n==0) return 1;
	if(n%2==0) return (mod_exp(a,n/2,mod)*mod_exp(a,n/2,mod))%mod;
	else return (a*mod_exp(a,n-1,mod))%mod;

}

void solve()
{

int n;
cin>>n;

for(int i=0;i<=777777;i++)
{
	bool flag1=true;
	int j=i;
	int sum=0;
	while(j)
	{
		sum+=j%10;
		if(j%10!=4&&j%10!=7)
		{

		flag1=false;
		break;
	}
		j/=10;
	}

	if(flag1) if(sum==n)
	{
	cout<<i<<endl;
	return ;
}

}

cout<<"-1"<<endl;

}

int main()
{

  //int t;
//  cin>>t;
 // t=100;
 // while(t--)
  solve();

}


#include<bits/stdc++.h>
using namespace std;
#define zhalok Zhalok
#define inf 100000.0
#define ll long long int
#define ull unsigned long long
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define negloop(i,a,b) for(ll i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vull vector<ull>
#define pb push_back
#define be begin()
#define en end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define MOD 1000000007
#define sz 200000

ll cill(ll a,ll b)
{
	if(a%b==0)
	return a/b;
	return a/b+1;
	}

ll maxx(ll a,ll b)
{
	return a>b?a:b;
}

ll minn(ll a,ll b)
{
	return a<b?a:b;
}

vll take_input(ll n)
{
	vll v;
//	v.pb(0);
	loop(i,0,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

vi take_input(int n)
{
	vi v;
	v.pb(0);
	loop(i,0,n)
	{
		int x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

void print(vll v)
{
	loop(i,0,v.size())
	cout<<v[i]<<" ";
	cout<<endl;
}

void print(vpll pairs)
{
	for(int i=0;i<pairs.size();i++) cout<<pairs[i].ff<<" "<<pairs[i].ss<<endl;
}

vll num_to_vect(ll n)
{
	vll v,temp;
	v.pb(0);
	while(n)
	{
		temp.pb(n%10);
		n/=10;
	}
	reverse(temp.begin(),temp.end());
	loop(i,0,temp.size())
	v.pb(temp[i]);
	return v;
 }

ll odd_n(ll n)
{
	return (n-1)/2+1;
}

	int gcd(int a ,int b)
	{
		if(a%b==0)
		return b;
		return gcd(b,a%b);
	}

ll get_min(vll v)
{
	ll mn=inf;
	loop(i,0,v.size())
	mn=minn(mn,v[i]);

	return mn;
}

void printt(vi v)
{
	loop(i,0,v.size()) cout<<v[i]<<" "; cout<<endl;
}

int bin_to_dec(string bin)
{
	int sum=0;
	for(int i=0;i<bin.size();i++)
	{
		sum*=10;
		sum+=(bin[i]-'0');

	}
	return sum;
}

double find_dis(pair <double,double> p1,pair <double,double> p2)
{
	return sqrt((p1.ff-p2.ff)*(p1.ff-p2.ff)+(p1.ss-p2.ss)*(p1.ss-p2.ss));
}

/*vll v;

ll ans;

void merge(int l,int r)
{
	int mid=(l+r)/2;
	vll temp(r-l+1,0);
	int i=l;
	int j=mid+1;
    int k=0;
	while(i<=mid&&j<=r)
	{
		if(v[i]<=v[j]) temp[k++]=v[i++];
		else
		{
			ans+=abs(k-(j-l));
			temp[k++]=v[j++];
		}
	}
	while(i<=mid) temp[k++]=(v[i++]);
	while(j<=r) temp[k++]=(v[j++]);

	for(int i=0,k=l;i<temp.size(),k<=r;i++,k++)
	v[k]=temp[i];

}

void mergesort(int l,int r)
{
	if(l>=r) return ;
    else
    {
    	int mid=(l+r)/2;
    	mergesort(l,mid);
    	mergesort(mid+1,r);
    	merge(l,r);
	}
}

*/

//*************************************

//*********************************************************

// the code starts here ...

ll how_many_substring(string s,string sub)
{
	ll cnt=0;
	loop(i,0,(s.size()-sub.size())+1)
	{
		bool flag=true;
		for(int k=i,j=0;j<sub.size();j++,k++)
		if(s[k]!=sub[j])
		{
			flag=false;
			break;
		}
		if(flag)
		cnt++;
	}
	return cnt;
}

vi v;

int find_ans(int lo,int hi)
{
	if(lo==hi) return v[lo];

	int mid=(lo+hi)/2;
	int left=find_ans(lo,mid);
	int right=find_ans(mid+1,hi);
	return max(max(left,right),left^right);
}

ll abss(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a;
}

ll mod_exp(ll a,ll n,ll mod)
{
	if(n==0) return 1;
	if(n%2==0) return (mod_exp(a,n/2,mod)*mod_exp(a,n/2,mod))%mod;
	else return (a*mod_exp(a,n-1,mod))%mod;

}

void solve()
{

ll n;
cin>>n;
ll len=cill(n,7);

for(int i=0;i<=len;i++)
{

ll fours=i;
ll sevens=len-i;
if(fours*4+sevens*7==n)
{
	for(int i=0;i<fours;i++) cout<<"4";
	for(int i=0;i<sevens;i++) cout<<"7";
	cout<<endl;
	return;
}

}

if(n%4==0)
{
	for(int i=0;i<n/4;i++) cout<<"4";
	cout<<endl;
	return ;
}

cout<<"-1"<<endl;

}

int main()
{

  //int t;
//  cin>>t;
 // t=100;
 // while(t--)
  solve();

}


#include<bits/stdc++.h>
using namespace std;
#define zhalok Zhalok
#define inf 100000.0
#define ll long long int
#define ull unsigned long long
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define negloop(i,a,b) for(ll i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vull vector<ull>
#define pb push_back
#define be begin()
#define en end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define MOD 1000000007
#define sz 200000

ll cill(ll a,ll b)
{
	if(a%b==0)
	return a/b;
	return a/b+1;
	}

ll maxx(ll a,ll b)
{
	return a>b?a:b;
}

ll minn(ll a,ll b)
{
	return a<b?a:b;
}

vll take_input(ll n)
{
	vll v;
//	v.pb(0);
	loop(i,0,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

vi take_input(int n)
{
	vi v;
	v.pb(0);
	loop(i,0,n)
	{
		int x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

void print(vll v)
{
	loop(i,0,v.size())
	cout<<v[i]<<" ";
	cout<<endl;
}

void print(vpll pairs)
{
	for(int i=0;i<pairs.size();i++) cout<<pairs[i].ff<<" "<<pairs[i].ss<<endl;
}

vll num_to_vect(ll n)
{
	vll v,temp;
	v.pb(0);
	while(n)
	{
		temp.pb(n%10);
		n/=10;
	}
	reverse(temp.begin(),temp.end());
	loop(i,0,temp.size())
	v.pb(temp[i]);
	return v;
 }

ll odd_n(ll n)
{
	return (n-1)/2+1;
}

	int gcd(int a ,int b)
	{
		if(a%b==0)
		return b;
		return gcd(b,a%b);
	}

ll get_min(vll v)
{
	ll mn=inf;
	loop(i,0,v.size())
	mn=minn(mn,v[i]);

	return mn;
}

void printt(vi v)
{
	loop(i,0,v.size()) cout<<v[i]<<" "; cout<<endl;
}

int bin_to_dec(string bin)
{
	int sum=0;
	for(int i=0;i<bin.size();i++)
	{
		sum*=10;
		sum+=(bin[i]-'0');

	}
	return sum;
}

double find_dis(pair <double,double> p1,pair <double,double> p2)
{
	return sqrt((p1.ff-p2.ff)*(p1.ff-p2.ff)+(p1.ss-p2.ss)*(p1.ss-p2.ss));
}

/*vll v;

ll ans;

void merge(int l,int r)
{
	int mid=(l+r)/2;
	vll temp(r-l+1,0);
	int i=l;
	int j=mid+1;
    int k=0;
	while(i<=mid&&j<=r)
	{
		if(v[i]<=v[j]) temp[k++]=v[i++];
		else
		{
			ans+=abs(k-(j-l));
			temp[k++]=v[j++];
		}
	}
	while(i<=mid) temp[k++]=(v[i++]);
	while(j<=r) temp[k++]=(v[j++]);

	for(int i=0,k=l;i<temp.size(),k<=r;i++,k++)
	v[k]=temp[i];

}

void mergesort(int l,int r)
{
	if(l>=r) return ;
    else
    {
    	int mid=(l+r)/2;
    	mergesort(l,mid);
    	mergesort(mid+1,r);
    	merge(l,r);
	}
}

*/

//*************************************

//*********************************************************

// the code starts here ...

ll how_many_substring(string s,string sub)
{
	ll cnt=0;
	loop(i,0,(s.size()-sub.size())+1)
	{
		bool flag=true;
		for(int k=i,j=0;j<sub.size();j++,k++)
		if(s[k]!=sub[j])
		{
			flag=false;
			break;
		}
		if(flag)
		cnt++;
	}
	return cnt;
}

vi v;

int find_ans(int lo,int hi)
{
	if(lo==hi) return v[lo];

	int mid=(lo+hi)/2;
	int left=find_ans(lo,mid);
	int right=find_ans(mid+1,hi);
	return max(max(left,right),left^right);
}

ll abss(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a;
}

ll mod_exp(ll a,ll n,ll mod)
{
	if(n==0) return 1;
	if(n%2==0) return (mod_exp(a,n/2,mod)*mod_exp(a,n/2,mod))%mod;
	else return (a*mod_exp(a,n-1,mod))%mod;

}

void solve()
{

ll n;
cin>>n;
vector< pair<ll,pii> >v;

for(int a=0;a*4<=n;a++)
{
   if((n-4*a)%7==0)
   {
   int b=(n-4*a)/7;
   v.pb({(a+b),{b,a}});
}

}

sort(v.begin(),v.end());

if(v.size()==0)
cout<<"-1"<<endl;
else
{

for(int i=0;i<v[0].ss.ss;i++)
cout<<"4";
for(int i=0;i<v[0].ss.ff;i++)
cout<<"7";
cout<<endl;

}

}

int main()
{

  //int t;
//  cin>>t;
 // t=100;
 // while(t--)
  solve();

}


#include<bits/stdc++.h>
using namespace std;
#define zhalok Zhalok
#define inf 100000.0
#define ll long long int
#define ull unsigned long long
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define negloop(i,a,b) for(ll i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vull vector<ull>
#define pb push_back
#define be begin()
#define en end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define MOD 1000000007
#define sz 200000

ll cill(ll a,ll b)
{
	if(a%b==0)
	return a/b;
	return a/b+1;
	}

ll maxx(ll a,ll b)
{
	return a>b?a:b;
}

ll minn(ll a,ll b)
{
	return a<b?a:b;
}

vll take_input(ll n)
{
	vll v;
//	v.pb(0);
	loop(i,0,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

vi take_input(int n)
{
	vi v;
	v.pb(0);
	loop(i,0,n)
	{
		int x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

void print(vll v)
{
	loop(i,0,v.size())
	cout<<v[i]<<" ";
	cout<<endl;
}

void print(vpll pairs)
{
	for(int i=0;i<pairs.size();i++) cout<<pairs[i].ff<<" "<<pairs[i].ss<<endl;
}

vll num_to_vect(ll n)
{
	vll v,temp;
	v.pb(0);
	while(n)
	{
		temp.pb(n%10);
		n/=10;
	}
	reverse(temp.begin(),temp.end());
	loop(i,0,temp.size())
	v.pb(temp[i]);
	return v;
 }

ll odd_n(ll n)
{
	return (n-1)/2+1;
}

	int gcd(int a ,int b)
	{
		if(a%b==0)
		return b;
		return gcd(b,a%b);
	}

ll get_min(vll v)
{
	ll mn=inf;
	loop(i,0,v.size())
	mn=minn(mn,v[i]);

	return mn;
}

void printt(vi v)
{
	loop(i,0,v.size()) cout<<v[i]<<" "; cout<<endl;
}

int bin_to_dec(string bin)
{
	int sum=0;
	for(int i=0;i<bin.size();i++)
	{
		sum*=10;
		sum+=(bin[i]-'0');

	}
	return sum;
}

double find_dis(pair <double,double> p1,pair <double,double> p2)
{
	return sqrt((p1.ff-p2.ff)*(p1.ff-p2.ff)+(p1.ss-p2.ss)*(p1.ss-p2.ss));
}

/*vll v;

ll ans;

void merge(int l,int r)
{
	int mid=(l+r)/2;
	vll temp(r-l+1,0);
	int i=l;
	int j=mid+1;
    int k=0;
	while(i<=mid&&j<=r)
	{
		if(v[i]<=v[j]) temp[k++]=v[i++];
		else
		{
			ans+=abs(k-(j-l));
			temp[k++]=v[j++];
		}
	}
	while(i<=mid) temp[k++]=(v[i++]);
	while(j<=r) temp[k++]=(v[j++]);

	for(int i=0,k=l;i<temp.size(),k<=r;i++,k++)
	v[k]=temp[i];

}

void mergesort(int l,int r)
{
	if(l>=r) return ;
    else
    {
    	int mid=(l+r)/2;
    	mergesort(l,mid);
    	mergesort(mid+1,r);
    	merge(l,r);
	}
}

*/

//*************************************

//*********************************************************

// the code starts here ...

ll how_many_substring(string s,string sub)
{
	ll cnt=0;
	loop(i,0,(s.size()-sub.size())+1)
	{
		bool flag=true;
		for(int k=i,j=0;j<sub.size();j++,k++)
		if(s[k]!=sub[j])
		{
			flag=false;
			break;
		}
		if(flag)
		cnt++;
	}
	return cnt;
}

vi v;

int find_ans(int lo,int hi)
{
	if(lo==hi) return v[lo];

	int mid=(lo+hi)/2;
	int left=find_ans(lo,mid);
	int right=find_ans(mid+1,hi);
	return max(max(left,right),left^right);
}

ll abss(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a;
}

ll mod_exp(ll a,ll n,ll mod)
{
	if(n==0) return 1;
	if(n%2==0) return (mod_exp(a,n/2,mod)*mod_exp(a,n/2,mod))%mod;
	else return (a*mod_exp(a,n-1,mod))%mod;

}

void solve()
{

ll n;
cin>>n;
vector< pair<ll,pii> >v;

for(int a=0;a<=n;a++)
{
   if((n-4*a)%7==0)
   {
   int b=(n-4*a)/7;
   v.pb({(a+b),{b,a}});
}

}

sort(v.begin(),v.end());

if(v.size()==0)
cout<<"-1"<<endl;
else
{

for(int i=0;i<v[0].ss.ss;i++)
cout<<"4";
for(int i=0;i<v[0].ss.ff;i++)
cout<<"7";
cout<<endl;

}

}

int main()
{

  //int t;
//  cin>>t;
 // t=100;
 // while(t--)
  solve();

}


#include<bits/stdc++.h>
using namespace std;
#define zhalok Zhalok
#define inf 100000.0
#define ll long long int
#define ull unsigned long long
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define negloop(i,a,b) for(ll i=a;i>=b;i--)
#define vi vector<int>
#define vll vector<ll>
#define vull vector<ull>
#define pb push_back
#define be begin()
#define en end()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define MOD 1000000007
#define sz 200000

ll cill(ll a,ll b)
{
	if(a%b==0)
	return a/b;
	return a/b+1;
	}

ll maxx(ll a,ll b)
{
	return a>b?a:b;
}

ll minn(ll a,ll b)
{
	return a<b?a:b;
}

vll take_input(ll n)
{
	vll v;
//	v.pb(0);
	loop(i,0,n)
	{
		ll x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

vi take_input(int n)
{
	vi v;
	v.pb(0);
	loop(i,0,n)
	{
		int x;
		cin>>x;
		v.pb(x);
	}

	return v;
}

void print(vll v)
{
	loop(i,0,v.size())
	cout<<v[i]<<" ";
	cout<<endl;
}

void print(vpll pairs)
{
	for(int i=0;i<pairs.size();i++) cout<<pairs[i].ff<<" "<<pairs[i].ss<<endl;
}

vll num_to_vect(ll n)
{
	vll v,temp;
	v.pb(0);
	while(n)
	{
		temp.pb(n%10);
		n/=10;
	}
	reverse(temp.begin(),temp.end());
	loop(i,0,temp.size())
	v.pb(temp[i]);
	return v;
 }

ll odd_n(ll n)
{
	return (n-1)/2+1;
}

	int gcd(int a ,int b)
	{
		if(a%b==0)
		return b;
		return gcd(b,a%b);
	}

ll get_min(vll v)
{
	ll mn=inf;
	loop(i,0,v.size())
	mn=minn(mn,v[i]);

	return mn;
}

void printt(vi v)
{
	loop(i,0,v.size()) cout<<v[i]<<" "; cout<<endl;
}

int bin_to_dec(string bin)
{
	int sum=0;
	for(int i=0;i<bin.size();i++)
	{
		sum*=10;
		sum+=(bin[i]-'0');

	}
	return sum;
}

double find_dis(pair <double,double> p1,pair <double,double> p2)
{
	return sqrt((p1.ff-p2.ff)*(p1.ff-p2.ff)+(p1.ss-p2.ss)*(p1.ss-p2.ss));
}

/*vll v;

ll ans;

void merge(int l,int r)
{
	int mid=(l+r)/2;
	vll temp(r-l+1,0);
	int i=l;
	int j=mid+1;
    int k=0;
	while(i<=mid&&j<=r)
	{
		if(v[i]<=v[j]) temp[k++]=v[i++];
		else
		{
			ans+=abs(k-(j-l));
			temp[k++]=v[j++];
		}
	}
	while(i<=mid) temp[k++]=(v[i++]);
	while(j<=r) temp[k++]=(v[j++]);

	for(int i=0,k=l;i<temp.size(),k<=r;i++,k++)
	v[k]=temp[i];

}

void mergesort(int l,int r)
{
	if(l>=r) return ;
    else
    {
    	int mid=(l+r)/2;
    	mergesort(l,mid);
    	mergesort(mid+1,r);
    	merge(l,r);
	}
}

*/

//*************************************

//*********************************************************

// the code starts here ...

ll how_many_substring(string s,string sub)
{
	ll cnt=0;
	loop(i,0,(s.size()-sub.size())+1)
	{
		bool flag=true;
		for(int k=i,j=0;j<sub.size();j++,k++)
		if(s[k]!=sub[j])
		{
			flag=false;
			break;
		}
		if(flag)
		cnt++;
	}
	return cnt;
}

vi v;

int find_ans(int lo,int hi)
{
	if(lo==hi) return v[lo];

	int mid=(lo+hi)/2;
	int left=find_ans(lo,mid);
	int right=find_ans(mid+1,hi);
	return max(max(left,right),left^right);
}

ll abss(ll a,ll b)
{
	if(a>b) return a-b;
	else return b-a;
}

ll mod_exp(ll a,ll n,ll mod)
{
	if(n==0) return 1;
	if(n%2==0) return (mod_exp(a,n/2,mod)*mod_exp(a,n/2,mod))%mod;
	else return (a*mod_exp(a,n-1,mod))%mod;

}

void solve()
{

ll n;
cin>>n;
ll len=cill(n,7);

for(int i=0;i<=len;i++)
{

ll fours=i;
ll sevens=len-i;
if(fours*4+sevens*7==n)
{
	for(int i=0;i<fours;i++) cout<<"4";
	for(int i=0;i<sevens;i++) cout<<"7";
	cout<<endl;
	return;
}

}

cout<<"-1"<<endl;

}

int main()
{

  //int t;
//  cin>>t;
 // t=100;
 // while(t--)
  solve();

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int f,s,t;
void getnumber(){
	while(t){
	if (t%7==0){
		++s; t -= 7;}
	else if(t%4 ==0){
		++f; t -=4;}
	else {
		++f; t -= 4;}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	if(t%2==0)
		cout<<-1;
	else{
	   getnumber();
	for(int i=0;i<f;++i)
		cout<<4;
	for(int i=0;i<s;++i)
		cout<<7;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int f,s,t;
void getnumber(){
	while(t){
	if (t%7==0){
		++s; t -= 7;}
	else
		++f; t -=4;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	getnumber();
	if(n == 0){
		while(f--) cout<<4;
		while(s--) cout<<7;}
	else
		cout<<-1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int f,s,t;
void getnumber(){
	while(t){
	if (t%7==0){
		++s; t -= 7;}
	else if(t%4 ==0){
		++f; t -=4;}
	else {
		++f; t -= 4;}
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	if(t%2==0)
		cout<<-1;
	else getnumber();

	for(int i=0;i<f;++i)
		cout<<4;
	for(int i=0;i<s;++i)
		cout<<7;
	return 0;
}


   #include<bits/stdc++.h>

   using namespace std;

int main()
{
    int n,i,j;
    cin>>n;
    vector<int>v;
    int bsev=0;
    int bfr=0;

    while(n>=0)
    {
        if(n%7==0)
        {
            bsev=n/7;
            n=0;
            break;
        }
        bfr++;
        n=n-4;
    }
    if(n==0)
    {
        while(bfr--) cout<<"4";
        while(bsev--) cout<<"7";
    }
    else cout<<"-1"<<endl;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int f,s,t;
void getnumber(){
	while(t){
	if (t%7==0){
		++s; t -= 7;}
	else
		++f; t -=4;
}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> t;
	getnumber();
	if(t == 0){
		while(f--) cout<<4;
		while(s--) cout<<7;}
	else
		cout<<-1;
	return 0;
}


#include<bits/stdc++.h>

using namespace std ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define pb push_back
#define pf push_front
#define mp make_pair

void start()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt" , "r" , stdin);
        freopen("output.txt" , "w" , stdout);
    #endif
}

int main(){
	fastio
	start() ;
	int n ;
	cin >> n ;
	int a,b;
	vector< pair<int,int> > v;
	for(int b = 1 ; b <= n/7 ; b++){
		a = (n-(b*7))/4 ;
		if((n-(b*7))%4==0){
			v.pb(mp(a,b)) ;
		}
	}
	if(v.size()){
		int min = INT_MAX ;
		int x=INT_MAX , y = INT_MAX ;
		// sort(v.begin(),v.end()) ;
		for(int i = 0 ; i < v.size() ; i++){
			if((v[i].first+v[i].second)<min){
				if(x>v[i].first){
					x=v[i].first ;
					y=v[i].second ;
				}
				min=(v[i].first+v[i].second);
			}
		}
		string s;
		for(int i = 0 ;  i < x ; i++){
			s+='4' ;
		}
		for(int i = 0 ; i < y ;i++){
			s+='7' ;
		}
		cout << s << endl ;
	}
	else if(n==4){
		cout << 4 << endl;
	}
	else
		cout << -1 << endl ;

    return 0 ;
}


#include<bits/stdc++.h>

using namespace std ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define pb push_back
#define pf push_front
#define mp make_pair

void start()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt" , "r" , stdin);
        freopen("output.txt" , "w" , stdout);
    #endif
}

int main(){
	fastio
	start() ;
	int n ;
	cin >> n ;
	int a,b;
	vector< pair<int,int> > v;
	for(int b = 0 ; b <= n/7 ; b++){
		a = (n-(b*7))/4 ;
		if((n-(b*7))%4==0){
			v.pb(mp(a,b)) ;
		}
	}
	if(v.size()){
		int min = INT_MAX ;
		int x=INT_MAX , y = INT_MAX ;
		// sort(v.begin(),v.end()) ;
		for(int i = 0 ; i < v.size() ; i++){
			if((v[i].first+v[i].second)<min){
				if(x>v[i].first){
					x=v[i].first ;
					y=v[i].second ;
				}
				min=(v[i].first+v[i].second);
			}
		}
		string s;
		for(int i = 0 ;  i < x ; i++){
			s+='4' ;
		}
		for(int i = 0 ; i < y ;i++){
			s+='7' ;
		}
		cout << s << endl ;
	}
	// else if(n==4){
	// 	cout << 4 << endl;
	// }
	else
		cout << -1 << endl ;

    return 0 ;
}


#include<bits/stdc++.h>

using namespace std ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define pb push_back
#define pf push_front
#define mp make_pair

void start()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt" , "r" , stdin);
        freopen("output.txt" , "w" , stdout);
    #endif
}

int main(){
	fastio
	start() ;
	int n ;
	cin >> n ;
	int a,b;
	vector< pair<int,int> > v;
	for(int b = 1 ; b <= n/7 ; b++){
		a = (n-(b*7))/4 ;
		if((n-(b*7))%4==0){
			v.pb(mp(a,b)) ;
		}
	}
	if(v.size()){
		int min = INT_MAX ;
		int x=INT_MAX , y = INT_MAX ;
		// sort(v.begin(),v.end()) ;
		for(int i = 0 ; i < v.size() ; i++){
			if((v[i].first+v[i].second)<min){
				if(x>v[i].first){
					x=v[i].first ;
					y=v[i].second ;
				}
				min=(v[i].first+v[i].second);
			}
		}
		string s;
		for(int i = 0 ;  i < x ; i++){
			s+='4' ;
		}
		for(int i = 0 ; i < y ;i++){
			s+='7' ;
		}
		cout << s << endl ;
	}
	else
		cout << -1 << endl ;

    return 0 ;
}


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * @Author: Tard1grad3                                                   *
 * @Last modified time: Monday, July 13th 2020, 8:05:06 pm (UTC+06:00)   *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <bits/stdc++.h>
using namespace std;
#define IC ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f(i, n) for(i=0; i<n; i++)
#define ff(i, n) for(i=n-1; i>=0; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define sz 105
typedef long long ll;
typedef double db;
typedef char ch;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef set<ll> sll;
const double PI = acos(-1);

// string str;
ll ar[sz];

int main()
{
    IC
    ll t, i, j, n, x, m, a, b, mx=0, cnt=0, fr=0, svn=0;
    cin >> n;
    if(!(n%4))
        fr=n/4;
    else if(!(n%7))
        svn=n/7;
    else
    {
        while(n%4)
        {
            n-=7;
            if(n<0)
                break;
            cnt++;
            if(!(n%4))
            {
                fr=n/4;
                svn=cnt;
            }
        }
    }
    if(!fr && !svn)
        cout << -1 << endl;
    else
    {
        for(i=0; i<fr; i++)
            cout << 4;
        for(i=0 ; i<svn; i++)
            cout << 7;
        cout <<endl;
    }
    return 0;
}


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * @Author: Tard1grad3                                                   *
 * @Last modified time: Monday, July 13th 2020, 8:34:33 pm (UTC+06:00)   *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <bits/stdc++.h>
using namespace std;
#define IC ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f(i, n) for(i=0; i<n; i++)
#define ff(i, n) for(i=n-1; i>=0; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define sz 105
typedef long long ll;
typedef double db;
typedef char ch;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef set<ll> sll;
const double PI = acos(-1);

// string str;
ll ar[sz];

int main()
{
    IC
    ll t, i, j, n, x, m, a, b, mx=0, cnt=0, fr=0, svn=0, fr2=0, svn2=0;
    cin >> n;
    if(!(n%4))
        fr=n/4;
    if(!(n%7))
        svn=n/7;
    if(fr && svn)
        fr=0;
    while(1)
    {
        n-=7;
        if(n<0)
            break;
        cnt++;
        if(!(n%4))
        {
            fr2=n/4;
            svn2=cnt;
        }
    }
    if(!svn && !(!fr2 && fr))
    {
        fr=fr2;
        svn=svn2;
    }
    if(!fr && !svn)
        cout << -1 << endl;
    else
    {
        for(i=0; i<fr; i++)
            cout << 4;
        for(i=0 ; i<svn; i++)
            cout << 7;
        cout <<endl;
    }
    return 0;
}


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * @Author: Tard1grad3                                                   *
 * @Last modified time: Monday, July 13th 2020, 8:26:08 pm (UTC+06:00)   *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <bits/stdc++.h>
using namespace std;
#define IC ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f(i, n) for(i=0; i<n; i++)
#define ff(i, n) for(i=n-1; i>=0; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define sz 105
typedef long long ll;
typedef double db;
typedef char ch;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef set<ll> sll;
const double PI = acos(-1);

// string str;
ll ar[sz];

int main()
{
    IC
    ll t, i, j, n, x, m, a, b, mx=0, cnt=0, fr=0, svn=0, fr2=0, svn2=0;
    cin >> n;
    if(!(n%4))
        fr=n/4;
    else if(!(n%7))
        svn=n/7;
    while(1)
    {
        n-=7;
        if(n<0)
            break;
        cnt++;
        if(!(n%4))
        {
            fr2=n/4;
            svn2=cnt;
        }
    }
    if(!svn)
    {
        fr=fr2;
        svn=svn2;
    }
    if(!fr && !svn)
        cout << -1 << endl;
    else
    {
        for(i=0; i<fr; i++)
            cout << 4;
        for(i=0 ; i<svn; i++)
            cout << 7;
        cout <<endl;
    }
    return 0;
}


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * @Author: Tard1grad3                                                   *
 * @Last modified time: Monday, July 13th 2020, 8:31:29 pm (UTC+06:00)   *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include <bits/stdc++.h>
using namespace std;
#define IC ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f(i, n) for(i=0; i<n; i++)
#define ff(i, n) for(i=n-1; i>=0; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define sz 105
typedef long long ll;
typedef double db;
typedef char ch;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef set<ll> sll;
const double PI = acos(-1);

// string str;
ll ar[sz];

int main()
{
    IC
    ll t, i, j, n, x, m, a, b, mx=0, cnt=0, fr=0, svn=0, fr2=0, svn2=0;
    cin >> n;
    if(!(n%4))
        fr=n/4;
    else if(!(n%7))
        svn=n/7;
    while(1)
    {
        n-=7;
        if(n<0)
            break;
        cnt++;
        if(!(n%4))
        {
            fr2=n/4;
            svn2=cnt;
        }
    }
    if(!svn && !(!fr2 && fr))
    {
        fr=fr2;
        svn=svn2;
    }
    if(!fr && !svn)
        cout << -1 << endl;
    else
    {
        for(i=0; i<fr; i++)
            cout << 4;
        for(i=0 ; i<svn; i++)
            cout << 7;
        cout <<endl;
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int nn=n;
    int a,b;
    int flag=0;
    for(int i=0;i<=n/4;i++)
    {
        nn=n-i*4;
        b=nn/7;
        a=i;
        if(nn%7==0)
        {
            flag=1;
            break;
        }
    }
    if(flag==0) {
        printf("-1");
    }
    else
    {
        for(int i=1;i<=a;i++)
            printf("4");
        for(int i=1;i<=b;i++)
            printf("7");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
    {
        int b=n/7;
        int x=n%7;int flag=-1;
        if(x==0)
        {
            for(int i=1;i<=b;i++)
            {
                printf("7");
            }
            printf("\n");
            continue;
        }
        for(int i=0;i<=b;++i)
        {
            if((x+7*i)%4==0)
            {
                flag=i;break;
            }
        }
        if(flag==-1)
        {
            printf("-1\n");
            continue;
        }
        int a=(x+7*flag)/4;
        for(int i=1;i<=a;i++)
        {
            printf("4");
        }
        flag=b-flag;
        for(int i=1;i<=flag;i++)
        {
            printf("7");
        }
        printf("\n");
        //printf("b=%d\n",b);
    }
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
    char s[1000000];
    int ans = 0;
    int n;
    scanf("%d", &n);
    int t = n / 7;
    int k = n % 7;
    int k1 = k / 4;
    int t1 = k % 4;
    if(t < t1){
        puts("-1");
        return 0;
    }
    for(int i = 0; i < k1; i++){
        printf("4");
    }
    for(int i = 0; i < t1; i++){
        printf("44");
    }
    t = t - t1;
    for(int i = 0; i < t; i++){
        printf("7");
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int m=n/7;
	int t,i;
	for (i=m;i>=0;i--)
	{
		if ((n-7*i)%4==0)
		{
			t=(n-7*i)/4;
			m=i;
			break;
		}
	}
	if (i==-1)
	cout<<"-1";
	else
	{
		for (i=0;i<t;i++)
		putchar('4');
		for (i=0;i<m;i++)
		putchar('7');
	}
	cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    if (n%7 == 0)
    {
        for (int i = 0;i < n/7;++i)
        {
            printf("7");
        }
        printf("\n");
    }
    else if (n%4 == 0)
    {
        for (int i = 0;i < n/4;++i)
        {
            printf("4");
        }
        printf("\n");
    }
    else
    {
        int p;
        int flag = 0;
        for (p = 1;p < 250000;++p) if ((n - 4*p) % 7 == 0) {flag = 1; break;}
        if (!flag) printf("-1\n");
        else {

            for (int i = 0;i < p;++i) printf("4");
            int t = (n-4*p)/7;
            for (int i = 0;i < t;++i) printf("7");
            printf("\n");
        }
    }
    return 0;
}


#include<string>
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cnt = n/4;
    int kk = 0;
    int cnt_7 = 0;
    int num = n%4;
    if(num == 2)
    {
         kk = 3;
         cnt_7 = 2;
    }
    if(num == 1)
    {
        cnt_7 = 3;
        kk = 5;
    }
    if(num == 3)
    {
        kk = 1;
        cnt_7 = 1;
    }
    if(cnt < kk)
        puts("-1");
    else
    {
        cnt -= kk;
        int flg = cnt/7;
        cnt -= flg*7;
        cnt_7 += flg*4;
        for(int i = 0; i < cnt; ++i)
            printf("4");
        for(int i = 0; i < cnt_7; ++i)
            printf("7");
        puts("");
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cek=0;
    int cek1=-1,cek2=-1;
    while (n > 0)
    {
        if (n % 4 == 0)
        {
            cek1=n/4;
            cek2=cek;
        }
        n-=7;
        cek++;
    }
    if (cek1 == -1 && cek2 == -1)
    {
        cout<<-1;
    }
    else{
        for(int i = 0 ; i < cek1 ; i++)
        {
            cout<<4;
        }
        for(int i = 0 ; i < cek2 ; i++)
        {
            cout<<7;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cek=0;
    int cek1=-1,cek2=-1;
    if (n == 7) cout<<7; return 0;
    while (n > 0)
    {
        if (n % 4 == 0)
        {
            cek1=n/4;
            cek2=cek;
        }
        n-=7;
        cek++;
    }
    if (cek1 == -1 && cek2 == -1)
    {
        cout<<-1;
    }
    else{
        for(int i = 0 ; i < cek1 ; i++)
        {
            cout<<4;
        }
        for(int i = 0 ; i < cek2 ; i++)
        {
            cout<<7;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cek=0;
    int cek1=-1,cek2=-1;
    if (n == 7){
        cout<<7;
        return 0;
    }
    while (n > 0)
    {
        if (n % 4 == 0)
        {
            cek1=n/4;
            cek2=cek;
        }
        n-=7;
        cek++;
    }
    if (cek1 == -1 && cek2 == -1)
    {
        cout<<-1;
    }
    else{
        for(int i = 0 ; i < cek1 ; i++)
        {
            cout<<4;
        }
        for(int i = 0 ; i < cek2 ; i++)
        {
            cout<<7;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cek=0;
    int cek1=-1,cek2=-1;
    while (n > 0)
    {
        if (n % 4 == 0)
        {
            cek1=n/4;
            cek2=cek;
            n/=4;
        }
        n-=7;
        cek++;
    }
    if (cek1 == -1 && cek2 == -1)
    {
        cout<<-1;
    }
    else{
        for(int i = 0 ; i < cek1 ; i++)
        {
            cout<<4;
        }
        for(int i = 0 ; i < cek2 ; i++)
        {
            cout<<7;
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int cek=0;
    int cek1=-1,cek2=-1;
    while (n >= 0)
    {
        if (n % 4 == 0)
        {
            cek1=n/4;
            cek2=cek;
        }
        n-=7;
        cek++;
    }
    if (cek1 == -1 && cek2 == -1)
    {
        cout<<-1;
    }
    else{
        for(int i = 0 ; i < cek1 ; i++)
        {
            cout<<4;
        }
        for(int i = 0 ; i < cek2 ; i++)
        {
            cout<<7;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
string ar;

int main()
{
    int n, k = 0, res;
    bool c= false;
    cin >> n;
    for(ll i = 0; i*4 <= n; i++)
    {
    	res = n - i*4;
    	if(res == 0 || res % 7 ==0)
    	{
    		for(ll j = 1; j <= i; j++)
    		{
    			cout << "4";
    		}
    		if(res % 7 == 0)
    		{
    			for(ll k = 0; k*7 < res; k++)
    		cout << "7";
    		}
    		c = true;
    		break;
    	}

    }
    if(!c)
    cout <<"-1";

      return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
string ar;

int main()
{
    int n, k = 0, res;
    bool c= false;
    cin >> n;
    for(ll i = 0; i*4 < n; i++)
    {
    	res = n - i*4;
    	if(res == 0 || res % 7 ==0)
    	{
    		for(ll j = 1; j <= i; j++)
    		{
    			cout << "4";
    		}
    		if(res % 7 == 0)
    		{
    			for(ll k = 0; k*7 < res; k++)
    		cout << "7";
    		}
    		c = true;

    	}

    }
    if(!c)
    cout <<"-1";

      return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
string ar;

int main()
{
    int n, k = 0, res;
    bool c= false;
    cin >> n;
    for(ll i = 0; i*4 < n; i++)
    {
    	res = n - i*4;
    	if(res == 0 || res % 7 ==0)
    	{
    		for(ll j = 1; j <= i; j++)
    		{
    			cout << "4";
    		}
    		if(res % 7 == 0)
    		{
    			for(ll k = 0; k*7 < res; k++)
    		cout << "7";
    		}
    		c = true;
    		break;
    	}

    }
    if(!c)
    cout <<"-1";

      return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define s(n) scanf("%d",&n)
#define P(n) printf("%d",&n)
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
//////////////////////////////////////////////////////
typedef struct s{
    int a;
    int index;
}sor;
int sorter(sor lhs, sor rhs) {
    if (lhs.a < rhs.a)
        return 1;
    return 0;
}
/////////////////////////////////////////////////////
bool isNumber(string s)
{
    for (int i = 0; i < s.length(); i++)
        if (isdigit(s[i]) == false)
            return false;

    return true;
}
/////////////////////////////////////////////////////////
bool isPrime(int num){
    if(num==2){
        return true;
    }
    if(num<2||num%2==0){
        return false;
    }
    for(int i=3;i*i<=num;i+=2){
        if(num%i==0){
            return false;
        }
    }
    return true;
}
/////////////////////////////////////////////////////////

string tostring (long long int p){
    ostringstream oss;
    oss<<p;
    return oss.str();
}

long long int toint(string str){
    long long int num;
    istringstream iss(str);
    iss>>num;
    return num;
}

int main()
{ int n;s(n);
int z=trunc(n/7);
n-=(z*7);
if(n%4!=0)printf("-1");
else{
    n/=4;
    for(int i=0;i<n;i++)printf("4");
    for(int i=0;i<z;i++)printf("7");
}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define s(n) scanf("%d",&n)
#define P(n) printf("%d",&n)
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
//////////////////////////////////////////////////////
typedef struct s{
    int a;
    int index;
}sor;
int sorter(sor lhs, sor rhs) {
    if (lhs.a < rhs.a)
        return 1;
    return 0;
}
/////////////////////////////////////////////////////
bool isNumber(string s)
{
    for (int i = 0; i < s.length(); i++)
        if (isdigit(s[i]) == false)
            return false;

    return true;
}
/////////////////////////////////////////////////////////
bool isPrime(int num){
    if(num==2){
        return true;
    }
    if(num<2||num%2==0){
        return false;
    }
    for(int i=3;i*i<=num;i+=2){
        if(num%i==0){
            return false;
        }
    }
    return true;
}
/////////////////////////////////////////////////////////

string tostring (long long int p){
    ostringstream oss;
    oss<<p;
    return oss.str();
}

long long int toint(string str){
    long long int num;
    istringstream iss(str);
    iss>>num;
    return num;
}

int main()
{ int n;s(n);
int z=trunc(n/7);
n-=(z*7);
if(n%4!=0)printf("-1");
else{
    for(int i=0;i<z;i++)printf("7");
    n/=4;
    for(int i=0;i<n;i++)printf("4");
}

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define s(n) scanf("%d",&n)
#define P(n) printf("%d",&n)
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
//////////////////////////////////////////////////////
typedef struct s{
    int a;
    int index;
}sor;
int sorter(sor lhs, sor rhs) {
    if (lhs.a < rhs.a)
        return 1;
    return 0;
}
/////////////////////////////////////////////////////
bool isNumber(string s)
{
    for (int i = 0; i < s.length(); i++)
        if (isdigit(s[i]) == false)
            return false;

    return true;
}
/////////////////////////////////////////////////////////
bool isPrime(int num){
    if(num==2){
        return true;
    }
    if(num<2||num%2==0){
        return false;
    }
    for(int i=3;i*i<=num;i+=2){
        if(num%i==0){
            return false;
        }
    }
    return true;
}
/////////////////////////////////////////////////////////

string tostring (long long int p){
    ostringstream oss;
    oss<<p;
    return oss.str();
}

long long int toint(string str){
    long long int num;
    istringstream iss(str);
    iss>>num;
    return num;
}

int main()
{ int n,k;
s(n);k=n;
while(k%7!=0){
    k-=4;
}
if(k<0)printf("-1");
else{
	while(n>k){
		printf("4");
		n-=4;
	}
	while(k>0){
		printf("7");
		k-=7;
	}
}

    return 0;
}


#define ARDUINO_WAIT_TIME 2000
#include<windows.h>
#include<SFML/Graphics.hpp>
#include<bits/stdc++.h>
using namespace sf;
using namespace std;
class Serial
{
    private:
        //Serial comm handler
        HANDLE hSerial;
        //Connection status
        bool connected;
        //Get various information about the connection
        COMSTAT status;
        //Keep track of last error
        DWORD errors;

    public:
        //Initialize Serial communication with the given COM port
        Serial(const char *portName);
        //Close the connection
        ~Serial();
        //Read data in a buffer, if nbChar is greater than the
        //maximum number of bytes available, it will return only the
        //bytes available. The function return -1 when nothing could
        //be read, the number of bytes actually read.
        int ReadData(char *buffer, unsigned int nbChar);
        //Writes data from a buffer through the Serial connection
        //return true on success.
        bool WriteData(const char *buffer, unsigned int nbChar);
        //Check if we are actually connected
        bool IsConnected();

};

Serial::Serial(const char *portName)
{
    //We're not yet connected
    this->connected = false;

    //Try to connect to the given port throuh CreateFile
    this->hSerial = CreateFile(portName,
            GENERIC_READ | GENERIC_WRITE,
            0,
            NULL,
            OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL,
            NULL);

    //Check if the connection was successfull
    if(this->hSerial==INVALID_HANDLE_VALUE)
    {
        //If not success full display an Error
        if(GetLastError()==ERROR_FILE_NOT_FOUND){

            //Print Error if neccessary
            printf("ERROR: Handle was not attached. Reason: %s not available.\n", portName);

        }
        else
        {
            printf("ERROR!!!");
        }
    }
    else
    {
        //If connected we try to set the comm parameters
        DCB dcbSerialParams = {0};

        //Try to get the current
        if (!GetCommState(this->hSerial, &dcbSerialParams))
        {
            //If impossible, show an error
            printf("failed to get current serial parameters!");
        }
        else
        {
            //Define serial connection parameters for the arduino board
            dcbSerialParams.BaudRate=CBR_9600;
            dcbSerialParams.ByteSize=8;
            dcbSerialParams.StopBits=ONESTOPBIT;
            dcbSerialParams.Parity=NOPARITY;
            //Setting the DTR to Control_Enable ensures that the Arduino is properly
            //reset upon establishing a connection
            dcbSerialParams.fDtrControl = DTR_CONTROL_ENABLE;

             //Set the parameters and check for their proper application
             if(!SetCommState(hSerial, &dcbSerialParams))
             {
                printf("ALERT: Could not set Serial Port parameters");
             }
             else
             {
                 //If everything went fine we're connected
                 this->connected = true;
                 //Flush any remaining characters in the buffers
                 PurgeComm(this->hSerial, PURGE_RXCLEAR | PURGE_TXCLEAR);
                 //We wait 2s as the arduino board will be reseting
                 Sleep(ARDUINO_WAIT_TIME);
             }
        }
    }

}

Serial::~Serial()
{
    //Check if we are connected before trying to disconnect
    if(this->connected)
    {
        //We're no longer connected
        this->connected = false;
        //Close the serial handler
        CloseHandle(this->hSerial);
    }
}

int Serial::ReadData(char *buffer, unsigned int nbChar)
{
    //Number of bytes we'll have read
    DWORD bytesRead;
    //Number of bytes we'll really ask to read
    unsigned int toRead;

    //Use the ClearCommError function to get status info on the Serial port
    ClearCommError(this->hSerial, &this->errors, &this->status);

    //Check if there is something to read
    if(this->status.cbInQue>0)
    {
        //If there is we check if there is enough data to read the required number
        //of characters, if not we'll read only the available characters to prevent
        //locking of the application.
        if(this->status.cbInQue>nbChar)
        {
            toRead = nbChar;
        }
        else
        {
            toRead = this->status.cbInQue;
        }

        //Try to read the require number of chars, and return the number of read bytes on success
        if(ReadFile(this->hSerial, buffer, toRead, &bytesRead, NULL) )
        {
            return bytesRead;
        }

    }

    //If nothing has been read, or that an error was detected return 0
    return 0;

}

bool Serial::WriteData(const char *buffer, unsigned int nbChar)
{
    DWORD bytesSend;

    //Try to write the buffer on the Serial port
    if(!WriteFile(this->hSerial, (void *)buffer, nbChar, &bytesSend, 0))
    {
        //In case it don't work get comm error and return false
        ClearCommError(this->hSerial, &this->errors, &this->status);

        return false;
    }
    else
        return true;
}

bool Serial::IsConnected()
{
    //Simply return the connection status
    return this->connected;
}
string to_string(int value){
	stringstream str;
	str<<value;
	return str.str();
}
// application reads from the specified serial port and reports the collected data
int main(){
	setlocale(LC_ALL,"");
	Texture t,rd,green,greeng;
	Font font;
	if(!font.loadFromFile("arial.ttf"))return 1;
	if(!t.loadFromFile("background.jpg"))return 1;
	if(!rd.loadFromFile("red.jpg"))return 1;
	if(!green.loadFromFile("green.jpg"))return 1;
	if(!greeng.loadFromFile("greenrev.jpg"))return 1;
	t.setSmooth(1);
	Sprite background,sp,red,green1,green2;
	red.setTexture(rd);
	green1.setTexture(green);
	green2.setTexture(greeng);
	background.setTexture(t);
	background.setPosition(850,20);
	background.setScale(Vector2f(0.5,0.5));
	Text text;
	text.setFont(font);
	text.setColor(Color::Black);
	text.setCharacterSize(34);
	text.setStyle(Text::Italic|Text::Bold);
	RenderWindow app(VideoMode(1100,600),"NKL control panel",Style::Close);
	app.clear(Color(241,255,253));
	app.draw(background);
	app.display();
	Serial* SP = new Serial("\\\\.\\COM3");
	while(SP->IsConnected()&&app.isOpen()){
		Event e;while(app.pollEvent(e))if(e.type==Event::Closed)app.close();
		Sleep(500);
		char incomingData[256] = "";
		int dataLength = 255;
		int readResult = 0;
		readResult = SP->ReadData(incomingData,dataLength);
        incomingData[readResult] = 0;
    //    	printf("%s\n",incomingData);
	   string s=incomingData;
       int a=s.find("$")+1,b=s.find("@");
       if(a==-1||b==-1||a>b)continue;
	   s=s.substr(a,b-a);
	   if(s.size()!=0){
	   	ifstream fin((string("users//$"+s+".txt")).c_str());
	   	if(fin.fail()){
	   		app.clear(Color(241,255,253));
			app.draw(background);
			string tmp="������������ � �������������\n"+s+"\n�� ������";
			text.setString(tmp);
			text.setColor(Color::Red);
			text.setPosition(Vector2f(5,5));
			app.draw(text);
			text.setColor(Color::Black);
			app.display();
	   		continue;
		   }
	   	string tp,cl,nm,sr,la,ac,pl,id;
	   	getline(fin,tp);
	   	getline(fin,cl);
	   	getline(fin,nm);
	   	getline(fin,sr);
	   	getline(fin,la);
	   	getline(fin,ac);
	   	getline(fin,pl);
	   	getline(fin,id);
	   	fin.close();
	   	SP->WriteData(ac.c_str(),ac.size());
	   	app.clear(Color(241,255,253));
		app.draw(background);
		Texture t;
		Sprite sp;
		t.loadFromFile(pl.c_str());
		t.setSmooth(1);
		sp.setTexture(t);
		sp.setPosition(Vector2f(5,5));
		sp.scale(Vector2f(300./t.getSize().x,300./t.getSize().x));
		app.draw(sp);
		text.setString("����:\n�����:\n���:\n�������:\n����������:\nID:\n����:\n�����:");
		text.setPosition(Vector2f(310,5));
		app.draw(text);
		text.setPosition(Vector2f(535,5));
		string tmp=tp+"\n"+cl+"\n"+nm+"\n"+sr+"\n"+la+"\n"+id;
		text.setString(tmp);
		app.draw(text);
		if(ac=="2"||ac=="3")text.setString("��������"),text.setColor(Color::Green);
		else text.setString("��������"),text.setColor(Color::Red);
		text.setPosition(Vector2f(445,245));
		app.draw(text);
		if(ac=="1"||ac=="3")text.setString("��������"),text.setColor(Color::Green);
		else text.setString("��������"),text.setColor(Color::Red);
		text.setPosition(Vector2f(445,285));
		app.draw(text);
		text.setColor(Color::Black);
		if(ac=="2"||ac=="3")green2.setPosition(Vector2f(10,300)),app.draw(green2);
		else red.setPosition(Vector2f(10,300)),app.draw(red);
		if(ac=="1"||ac=="3")green1.setPosition(Vector2f(740,300)),app.draw(green1);
		else red.setPosition(Vector2f(740,300)),app.draw(red);
		app.display();
		string ser_tm;
		time_t temp_t;
		tm* server_time;
		temp_t=time(NULL);
		server_time=localtime(&temp_t);
		ser_tm=to_string(server_time->tm_year+1900)+"-";
		if(server_time->tm_mon+1<10)ser_tm+="0";
		ser_tm+=to_string(server_time->tm_mon+1)+"-";
		if(server_time->tm_mday<10)ser_tm+="0";
		ser_tm+=to_string(server_time->tm_mday)+" ";
		if(server_time->tm_hour<10)ser_tm+="0";
		ser_tm+=to_string(server_time->tm_hour)+":";
		if(server_time->tm_min<10)ser_tm+="0";
		ser_tm+=to_string(server_time->tm_min)+":";
		if(server_time->tm_sec<10)ser_tm+="0";
		ser_tm+=to_string(server_time->tm_sec);
		ofstream fout((string("users//$"+s+".txt")).c_str());
		fout<<tp<<"\n"<<cl<<"\n"<<nm<<"\n"<<sr<<"\n"<<ser_tm<<"\n"<<ac<<"\n"<<pl<<"\n"<<id;
		fout.close();
		fin.close();
	   }
	}
	return 0;
}


//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
pair<int,int>dp[1000001];
int i;
pair<int,int>mn(pair<int,int>a,pair<int,int>b){
    if(a.fr+a.sc<b.fr+b.sc)return a;
    if(a.fr+a.sc>b.fr+b.sc)return b;
    return min(a,b);
}
int main(){
    dp[4]={1,0};
    dp[7]={0,1};
    for(i=8;i<1000001;i++){
        if(dp[i-4]!=dp[0])dp[i]={dp[i-4].fr+1,dp[i-4].sc};
        if(dp[i-7]!=dp[0])if(dp[i]==dp[0])dp[i]={dp[i-7].fr,dp[i-7].sc+1};
        else dp[i]=mn(dp[i],{dp[i-7].fr,dp[i-7].sc+1});
    }
    cin>>i;
    if(dp[i]==dp[0])puts("-1");
    else{
        while(dp[i].fr--)printf("4");
        while(dp[i].sc--)printf("7");
    }
}


//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
pair<int,int>dp[1000001];
int i;
pair<int,int>mn(pair<int,int>a,pair<int,int>b){
    if(a.fr+a.sc<b.fr+b.sc)return a;
    if(a.fr+a.sc>b.fr+b.sc)return b;
    return min(a,b);
}
int main(){
    dp[4]={1,0};
    dp[7]={0,1};
    for(i=8;i<1000001;i++){
        if(dp[i-4]!=dp[0])dp[i]={dp[i-4].fr+1,dp[i-4].sc};
        if(dp[i-7]!=dp[0])if(dp[i]==dp[0])dp[i]={dp[i-7].fr,dp[i-7].sc+1};
        else dp[i]=mn(dp[i],{dp[i-7].fr,dp[i-7].sc+1});
    }
    cin>>i;
    int j=i/28;
    i%=28;
    if(dp[i]==dp[0]&&j==0)puts("-1");
    else{
        while(dp[i].fr--)printf("4");
        while(dp[i].sc--)printf("7");
        while(j--)printf("7777");
    }
}


//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
pair<int,int>dp[1000001];
int i;
pair<int,int>mn(pair<int,int>a,pair<int,int>b){
    if(a.fr+a.sc<b.fr+b.sc)return a;
    if(a.fr+a.sc>b.fr+b.sc)return b;
    return min(a,b);
}
int main(){
    dp[4]={1,0};
    dp[7]={0,1};
    for(i=8;i<1000001;i++){
        if(dp[i-4]!=dp[0])dp[i]={dp[i-4].fr+1,dp[i-4].sc};
        if(dp[i-7]!=dp[0])dp[i]={dp[i-7].fr,dp[i-7].sc+1};
    }
    cin>>i;
    if(dp[i]==dp[0])puts("-1");
    else{
        while(dp[i].fr--)printf("4");
        while(dp[i].sc--)printf("7");
    }
}


//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
pair<int,int>dp[1000001];
int i;
pair<int,int>mn(pair<int,int>a,pair<int,int>b){
    if(a.fr+a.sc<b.fr+b.sc)return a;
    if(a.fr+a.sc>b.fr+b.sc)return b;
    return min(a,b);
}
int main(){
    dp[4]={1,0};
    dp[7]={0,1};
    for(i=8;i<1000001;i++){
        if(dp[i-4]!=dp[0])dp[i]={dp[i-4].fr+1,dp[i-4].sc};
        if(dp[i-7]!=dp[0])if(dp[i]==dp[0])dp[i]={dp[i-7].fr,dp[i-7].sc+1};
        else dp[i]=mn(dp[i],{dp[i-7].fr,dp[i-7].sc+1});
    }
    cin>>i;
    int j=i/28;
    i%=28;
    if(dp[i]==dp[0])puts("-1");
    else{
        while(dp[i].fr--)printf("4");
        while(dp[i].sc--)printf("7");
        while(j--)printf("7777");
    }
}


//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
pair<int,int>dp[1000001];
int i;
pair<int,int>mn(pair<int,int>a,pair<int,int>b){
    if(a.fr+a.sc<b.fr+b.sc)return a;
    if(a.fr+a.sc>b.fr+b.sc)return b;
    return min(a,b);
}
int main(){
    dp[4]={1,0};
    dp[7]={0,1};
    for(i=8;i<1000001;i++){
        if(dp[i-4]!=dp[0])dp[i]={dp[i-4].fr+1,dp[i-4].sc};
        if(dp[i-7]!=dp[0])dp[i]={dp[i-7].fr,dp[i-7].sc+1};
    }
    cin>>i;
    if(dp[i]==dp[0]&&j==0)puts("-1");
    else{
        while(dp[i].fr--)printf("4");
        while(dp[i].sc--)printf("7");
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
void print(int _4, int _7){
    while(_4--) cout<<4;
    while(_7--) cout<<7; cout<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    int n; cin>>n;
    int _4 = n / 4;
    int rem = n % 4;
    if(rem == 0) print(_4, 0);
    else if(rem == 3) print(_4-1, 1);
    else cout<<-1<<endl;

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
int n, lim;
string bfs(){
    queue<pair<string, int> > q;
    q.push({"4", 4});
    q.push({"7", 7});

    while(!q.empty()){
        string s = q.front().ff;
        int sum = q.front().ss; q.pop();
        if(sum == n) return s;
        if(sum > lim) return "-1";

        q.push({s+'4', sum+4});
        q.push({s+'7', sum+7});
    }
    return "-1";
}
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    cin>>n;
    lim = ceil(n/4) * 7;
    cout<<bfs()<<endl;

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
int n;
string bfs(){
    queue<pair<string, int> > q;
    q.push({"4", 4});
    q.push({"7", 7});

    while(!q.empty()){
        string s = q.front().ff;
        int sum = q.front().ss; q.pop();
        if(sum == n) return s;
        if(sum > n) return "-1";
        q.push({s+'4', sum+4});
        q.push({s+'7', sum+7});
    }
    return "-1";
}
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    cin>>n;
    string ans = bfs();
    cout<<ans<<endl;

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
int n, rem, _44, _77;
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    cin>>n;
    _44 = n / 4; rem = n % 4;
    if(rem == 3) _44--, _77++, rem = 0;
    int x = _44 / 7;
    _44 -= (7*x);
    _77 += (4*x);
    if(rem != 0) cout<<-1<<endl;
    else {
        while(_44--) cout<<4;
        while(_77--) cout<<7; cout<<endl;
    }

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
int n, lim;
string bfs(){
    queue<pair<string, int> > q;
    q.push({"4", 4});
    q.push({"7", 7});

    while(!q.empty()){
        string s = q.front().ff;
        int sum = q.front().ss; q.pop();
        if(sum == n) return s;
        if(s.size() >= lim) return "-1";

        q.push({s+'4', sum+4});
        q.push({s+'7', sum+7});
    }
    return "-1";
}
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    cin>>n;
    lim = ceil(n/4);
    cout<<bfs()<<endl;

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
#define FastIO      ios_base::sync_with_stdio(false); cin.tie(0);
#define aPrint(a,b,c)for(int i=b;i<=c;i++)cout<<a[i]<<" ";cout<<endl;
#define vPrint(a)   for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;
#define Case(t)     printf("Case %d: ", t)
#define clr(x,a)    memset(x,a,sizeof(x))
#define debug(x)    cerr<<#x<<" = "<<(x)<<"\n"

#define umap        unordered_map
#define pii         pair<int, int>
#define ff          first
#define ss          second
#define mp          make_pair
#define pb          push_back
#define ppb         pop_back
#define sf          scanf
#define pf          printf
#define all(a)      a.begin(),a.end()
#define allr(a)     a.rbegin(),a.rend()
#define Unique(a)   sort(all(a)), a.erase(unique(all(a)),a.end())
template <class T> inline T bigmod(T b,T p,T M){ll ret=1;for(;p>0;p>>=1){if(p&1) ret=(ret*b)%M;b=(b*b)%M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T lcm(T a,T b){return a*b / gcd<T>(a, b);}
template <class T> inline T power(T b,T p){ll x=1;while(p--)x*=b;return x;}
const ll mod = 1e9 + 7;

#define pi        acos(-1.0)//3.1415926535897932
#define inf       1e9 + 7
#define MAX       300010
/// 'N'+'A'+'E'+'E'+'E'+'M' ///
int four, seven, n, flag;
int main()
{
    #ifndef ONLINE_JUDGE
        clock_t tStart = clock();
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif
    FastIO;

    cin>>n;
    int _7 = n / 7;
    for(int i=_7; i>=0; i--){
        int _4 = n - (7*i);
        if(_4%4 == 0){
            seven = i, four = _4 / 4;
            flag = 1; break;
        }
    }
    if(!flag) cout<<-1<<endl;
    else {
        while(four--) cout<<4;
        while(seven--) cout<<7; cout<<endl;
    }

    #ifndef ONLINE_JUDGE
        printf("\n**Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scll(a) scanf("%lld",&a)
#define scc(a) scanf(" %c",&a)
#define scs(a) scanf(" %s",a)
#define pb push_back
#define pf push_front
using namespace std;
typedef pair<int, int> pi;
typedef pair<double, int> dpi;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pi> vpi;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;
const double PI = 3.14159265359;
const double eps = 1e-7;
vector <ll> lucky_numbers;
void build(ll x)
{
	if(x > 1e10)
		return ;
	if(x != 4 && x!=7)
		lucky_numbers.pb(x);
	build(10*x + 4);
	build(10*x + 7);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("output.txt" , "w" , stdout);
	//freopen("input.txt" , "r" , stdin);
	int n;
	cin >> n;
	lucky_numbers.pb(4);
	lucky_numbers.pb(7);
	build(4);
	build(7);
	for(auto x:lucky_numbers)
	{
		ll b = x;
		int s = 0;
		while(x)
		{
			s += x % 10;
			x /= 10;
		}
		if(s == n)
		{
			cout << b;
			return 0;
		}
	}
	cout << -1;
	return 0;
}


#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scll(a) scanf("%lld",&a)
#define scc(a) scanf(" %c",&a)
#define scs(a) scanf(" %s",a)
#define pb push_back
#define pf push_front
using namespace std;
typedef pair<int, int> pi;
typedef pair<double, int> dpi;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pi> vpi;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;
const double PI = 3.14159265359;
const double eps = 1e-7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("output.txt" , "w" , stdout);
	//freopen("input.txt" , "r" , stdin);
	int n;
	cin >> n;
	if ((n < 11 && n!=4 && n!= 7 && n!=8) || n == 13 || n==17)
		cout << -1;
	else
	{
		while(n % 7 != 0)
		{
			cout << 4;
			n -=4;
		}
		while(n)
		{
			cout << 7;
			n -= 7;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scll(a) scanf("%lld",&a)
#define scc(a) scanf(" %c",&a)
#define scs(a) scanf(" %s",a)
#define pb push_back
#define pf push_front
using namespace std;
typedef pair<int, int> pi;
typedef pair<double, int> dpi;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pi> vpi;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;
const double PI = 3.14159265359;
const double eps = 1e-7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("output.txt" , "w" , stdout);
	//freopen("input.txt" , "r" , stdin);
	int n;
	cin >> n;
	if(n % 4 != 0 && n % 7 != 0)
		cout << -1;
	else
	{
		while(n % 7 != 0)
		{
			cout << 4;
			n -=4;
		}
		while(n)
		{
			cout << 7;
			n -= 7;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,f,s;
int main() {
	f=s=1e9;
	scanf("%d",&n);
	if(n==7){cout << n ; return 0}
	if(n==4){cout << n ; return 0}
	for(int i = 0 ;i < n/7+(n%7!=0) ; i++){
		if(7*i>n)break;
		if(!((n-7*i)%4)){
			if(i+((n-7*i)/4)<s+f){
				f=(n-7*i)/4;
				s=i;
			}
		}
	}
	if(f+s>n)cout << -1 << endl;
	else for(int i = 0 ; i <s+f ; i++)cout << ((i<f)?4:7);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,f,s;
int main() {
	f=s=1e9;
	scanf("%d",&n);
	if(n==7){cout << n ; return 0;}
	if(n==4){cout << n ; return 0;}
	for(int i = 0 ;i < 1000000 ; i++){
		if(7*i>n)break;
		if(!((n-7*i)%4)){
			if((i+((n-7*i)/4))<(s+f)){
				f=(n-7*i)/4;
				s=i;
			}
		}
	}
	if(f+s>n)cout << -1 << endl;
	else for(int i = 0 ; i <s+f ; i++)cout << ((i<f)?4:7);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,f,s;
int main() {
	f=s=1e9;
	scanf("%d",&n);
	if(n==7){cout << n ; return 0;}
	if(n==4){cout << n ; return 0;}
	for(int i = 0 ;i < n/7+(n%7!=0) ; i++){
		if(7*i>n)break;
		if(!((n-7*i)%4)){
			if(i+((n-7*i)/4)<s+f){
				f=(n-7*i)/4;
				s=i;
			}
		}
	}
	if(f+s>n)cout << -1 << endl;
	else for(int i = 0 ; i <s+f ; i++)cout << ((i<f)?4:7);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,f,s;
int main() {
	f=s=1e9;
	scanf("%d",&n);
	for(int i = 0 ;i < n/7+(n%7!=0) ; i++){
		if(7*i>n)break;
		if(!((n-7*i)%4)){
			if(i+((n-7*i)/4)<s+f){
				f=(n-7*i)/4;
				s=i;
			}
		}
	}
	if(f+s>n)cout << -1 << endl;
	else for(int i = 0 ; i <s+f ; i++)cout << ((i<f)?4:7);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;

  string out = "";

  for (int i = 0; ; i++){
    if (7*i > n) {cout << -1; return 0;}
    if ((n - 7*i) % 4 == 0){
      for (int j = 0; j < (n - 7*i)/4; j++) cout << 4;
      for (int j = 0; j < i; j++) cout << 7;
      return 0;
    }
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;

  string out = "";

  for (int i = 0; ; i++){
    if (4*i > n) {cout << -1; return 0;}
    if ((n - 4*i) % 7 == 0){
      for (int j = 0; j < i; j++) cout << 4;
      for (int j = 0; j < (n - 4*i)/7; j++) cout << 7;
      return 0;
    }
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;

  string out = "";

  for (int i = 0; ; i++){
    if ((n - 7*i) % 4 == 0){
      for (int j = 0; j < (n - 7*i)/4; j++) cout << 4;
      for (int j = 0; j < i; j++) cout << 7;
      return 0;
    }
    if (7*i > n) {cout << -1; return 0;}
  }
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string.h>
#include <cstdlib>
#include <ctime>
typedef long long ll ;
using namespace std;
int n;
string jj;
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //freopen("read.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n;
    while(n)
    {
        if(n<=0)
            break;
        if(n%4==0)
            jj+='4',n-=4;
        else if(n%7==0)
            jj+='7',n-=7;
        else
            jj+='4',n-=4;
    }
    if(n!=0)
        cout<<-1<<endl;
    else
    cout<<jj<<endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string.h>
#include <cstdlib>
#include <ctime>
typedef long long ll ;
using namespace std;
int n;
string jj;
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //freopen("read.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n;
    while(n)
    {
        if(n<=0)
            break;
        if(n%7==0)
            jj+='7',n-=7;
        else
            jj+='4',n-=4;
    }
    if(n!=0)
        cout<<-1<<endl;
    else
    cout<<jj<<endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string.h>
#include <cstdlib>
#include <ctime>
typedef long long ll ;
using namespace std;
int n;
string jj;
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //freopen("read.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n;
    while(n)
    {
        if((n-4)%4==0)
            jj+='4',n-=4;
        else if((n-4)%7==0)
            jj+='4',n-=4;
        else if((n-7)%4==0)
            jj+='7',n-=7;
        else if((n-7)%7==0)
            jj+='7',n-=7;
        else
        {
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<jj<<endl;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string.h>
#include <cstdlib>
#include <ctime>
typedef long long ll ;
using namespace std;
vector< int >vec;
void lucky(int d)
{
    if(d>(1000000))
        return ;
    vec.push_back(d);
    lucky(d*10+4);
    lucky(d*10+7);
}
int sum(int d)
{
    int var=0;
    while(d)
    {
        var+=(d%10);
        d/=10;
    }
    return var;
}
int idx=(1e9),n;
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //freopen("read.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    lucky(0);
    cin>>n;
    for(int j=0;j<vec.size();j++)
    {
        if(sum(vec[j])==n)
            idx=min(idx,vec[j]);
    }
    if(idx==(1e9))
        idx=-1;
    cout<<idx;

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string.h>
#include <cstdlib>
#include <ctime>
typedef long long ll ;
using namespace std;
int n;
string jj;
int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    //freopen("read.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n;
    while(n)
    {
        if((n-4)%4==0)
            jj+='4',n-=4;
        else if((n-4)%7==0)
            jj+='4',n-=4;
        else if((n-4)%11==0)
            jj+='4',n-=4;
        else if((n-7)%4==0)
            jj+='7',n-=7;
        else if((n-7)%7==0)
            jj+='7',n-=7;
        else
        {
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<jj<<endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MAX = 998244353;

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
    ios;
ll n;
cin>>n;

    ll co=n/7;
    ll lef=n%7;
    ll four=0;
    ll seven=co;
    if(lef==4)
        four=1;
   else if(lef!=0)
    {
     if(seven>=lef)
     {
         seven-=lef;
         four=2*lef;
     }
     else
        four=-1;
    }

    if(four!=-1)
    {

        for(ll i=0;i<four;i++)
            cout<<4;
        for(ll i=0;i<seven;i++)
            cout<<7;
    }
    else
        cout<<-1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MAX = 998244353;

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
    ios;
ll n;
cin>>n;

    ll co=n/7;
    ll lef=n%7;
    ll four=0;
    ll seven=co;
    if(lef==4)
        four=1;
   else if(lef!=0)
    {
     if(seven>=lef)
     {
         seven-=lef;
         four=2*lef;
     }
     else
        four=-1;
    }
   if(four==-1)
   {
   co=n/4;
   lef=n%4;
    four=co;
    seven=0;
    if(lef==1)
    {
        if(four>=5)
        {
            four-=5;
        seven+=3;
        }
        else
        {seven=-1;
        }
    }
      else if(lef==2)
    {
        if(four>=3)
        {
            four-=3;
        seven+=2;
        }
        else
        {seven=-1;
        }
    }
    else if(lef==3)
    {
        if(four>=1)
        {
            four-=1;
        seven+=1;
        }
        else
        {seven=-1;
        }
    }

   }
    if(four!=-1&&seven!=-1)
    {

        for(ll i=0;i<four;i++)
            cout<<4;
        for(ll i=0;i<seven;i++)
            cout<<7;
    }
    else
        cout<<-1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MAX = 998244353;

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
    ios;
ll n;
cin>>n;

    ll co=n/4;
    ll lef=n%4;
    ll four=co;
    ll seven=0;
    if(lef==1)
    {
        if(four>=5)
        {
            four-=5;
        seven+=3;
        }
        else
        {seven=-1;
        }
    }
      else if(lef==2)
    {
        if(four>=3)
        {
            four-=3;
        seven+=2;
        }
        else
        {seven=-1;
        }
    }
    else if(lef==3)
    {
        if(four>=1)
        {
            four-=1;
        seven+=1;
        }
        else
        {seven=-1;
        }
    }
    if(seven!=-1)
    {

        for(ll i=0;i<four;i++)
            cout<<4;
        for(ll i=0;i<seven;i++)
            cout<<7;
    }
    else
        cout<<-1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MAX = 998244353;

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
    ios;
ll n;
cin>>n;

    ll co=n/7;
    ll lef=n%7;
    ll four=0;
    ll seven=co;
    if(lef!=0)
    {
     if(seven>=lef)
     {
         seven-=lef;
         four=2*lef;
     }
     else
        four=-1;
    }

    if(four!=-1)
    {

        for(ll i=0;i<four;i++)
            cout<<4;
        for(ll i=0;i<seven;i++)
            cout<<7;
    }
    else
        cout<<-1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll MAX = 998244353;

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main() {
    ios;
ll n;
cin>>n;

    ll co=n/7;
    ll lef=n%7;
    ll four=lef/4;
    lef%=4;
    ll seven=co;

  if(lef!=0)
    {
     if(seven>=lef)
     {
         seven-=lef;
         four+=2*lef;
     }
     else
        four=-1;
    }

    if(four!=-1&&seven!=-1)
    {

        for(ll i=0;i<four;i++)
            cout<<4;
        for(ll i=0;i<seven;i++)
            cout<<7;
    }
    else
        cout<<-1;
	return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define test            int t; cin>>t; while(t--)
#define io             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main(){
 io ;

     int n;
     cin >> n;

     //4*x + 7*y == n. gots to find the x and y.
     int f = 0;
     pii ans ={-1,-1} ;
     for (int i = 0; i <= 1e6; i++){

         //i is the num of times , 4 occurs.
         if(4*i>n){
             break;
         }

         int s = 0, e = 1e6;
         while(s<e){
             int mid = (s + e) / 2;
             if(4*i + 7*mid >n ){
                 e = mid - 1;
             }else if(4*i + 7*mid ==n){
                 if(ans.ff==-1 and ans.ss==-1){
                     ans.ff = i;
                     ans.ss = mid;
                 }
                 if(i+mid<ans.ff+ans.ss){
                 ans.ff = i;
                 ans.ss = mid;
                 }
               //  cout << i << " " << mid;
                 f = 1;
                 break;
             }else{
                 s = mid + 1;
             }
         }
     }

     if(!f){
         cout << "-1\n";
         return 0;
     }
     string str;
     for (int i = 1; i <= ans.ff;i++)
     {
         str += '4';
     }
     for (int i = 1; i <= ans.ss; i++){
         str += '7';
     }
     cout << str << "\n";
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define test            int t; cin>>t; while(t--)
#define io             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main(){
 io ;

     int n;
     cin >> n;

     //4*x + 7*y == n. gots to find the x and y.
     int f = 0;
     pii ans ={-1,-1} ;
     for (int i = 0; i <= 1e6; i++){

         //i is the num of times , 4 occurs.
         if(4*i>n){
             break;
         }

         int s = 1, e = 1e6;
         while(s<e){
             int mid = (s + e) / 2;
             if(4*i + 7*mid >n ){
                 e = mid - 1;
             }else if(4*i + 7*mid ==n){
                 if(ans.ff==-1 and ans.ss==-1){
                     ans.ff = i;
                     ans.ss = mid;
                 }
                 if(i+mid<ans.ff+ans.ss){
                 ans.ff = i;
                 ans.ss = mid;
                 }
               //  cout << i << " " << mid;
                 f = 1;
                 break;
             }else{
                 s = mid + 1;
             }
         }
     }

     if(!f){
         cout << "-1\n";
         return 0;
     }
     string str;
     for (int i = 1; i <= ans.ff;i++)
     {
         str += '4';
     }
     for (int i = 1; i <= ans.ss; i++){
         str += '7';
     }
     cout << str << "\n";
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define test            int t; cin>>t; while(t--)
#define io             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main(){
 io ;

     int n;
     cin >> n;

     //4*x + 7*y == n. gots to find the x and y.
     int f = 0;
     pii ans ={-1,-1} ;
     for (int i = 0; i <= 1e6; i++){

         //i is the num of times , 4 occurs.
         if(4*i>n){
             break;
         }/*
        if(i==1){
            cout << "1";
        } */
         int s = 0, e = 1e6;
         while(s<=e){
             int mid = (s + e) / 2;
             if(4*i + 7*mid >n ){
                 e = mid - 1;
             }else if(4*i + 7*mid ==n){
                 if(ans.ff==-1 and ans.ss==-1){
                     ans.ff = i;
                     ans.ss = mid;
                 }
                 if(i+mid<ans.ff+ans.ss){
                 ans.ff = i;
                 ans.ss = mid;
                 }
               //  cout << i << " " << mid;
                 f = 1;
                 break;
             }else{
                 s = mid + 1;
             }
         }
     }
      //  cout << ans.ff << " " << ans.ss << "\n";

     if(!f){
         cout << "-1\n";
         return 0;
     }
    // cout << ans.ff << " " << ans.ss << "\n";
      string str;
     for (int i = 1; i <= ans.ff;i++)
     {
         str += '4';
     }
     for (int i = 1; i <= ans.ss; i++){
         str += '7';
     }
     cout << str << "\n";
}


#include <bits/stdc++.h>
using namespace std;
//Hello Hacker :D
int main()
{
    int x;
    cin >> x;//
    for(int i = 1 ; i < 10000000; i++)
    {
        if((x-i*7)/4>=1){
        if( i*4 + ((x - i*4)/7)*7 == x)//4*a = n - 7*b
        {
            for(int j = 0 ; j < i ; j++)cout << 4 ;
            for(int j = 0 ; j < (x - i*4)/7 ; j++)cout << 7;

            return 0 ;
        }
        }
    }
    cout << -1;
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e9 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        ll mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] - a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

ll ans[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    ll j = 0;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        for (int i = 0; i < n * 2; i ++) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        cout << a[(((n * 2) + 1) / 2 )] - a[(((n * 2) + 1) / 2) - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;

    while (t -- ){
        int n;
        cin >> n;
        int k = n * 2;
        int a[n];
        foo (i, k) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        int mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] -  a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (ll i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e9 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin >> t;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        ll mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] - a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        int n;
        cin >> n;
        ll a[n * 2];
        for (int i = 0; i < n * 2; i ++) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        cout << a[(((n * 2) + 1) / 2 )] - a[(((n * 2) + 1) / 2) - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        int n;
        cin >> n;
        int a[n];
        for (int i = 0; i < n * 2; i ++) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        cout << a[(((n * 2) + 1) / 2 )] - a[(((n * 2) + 1) / 2) - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e9 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        int n;
        cin >> n;
        int a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        int mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] - a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (ll i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e9 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        ll mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] - a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;

    while (t -- ){
        int n;
        cin >> n;
        int k = n * 2;
        int a[n];
        foo (i, k) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        int mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] << -  << a[mid - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

ll ans[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin >> t;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        for (int i = 0; i < n * 2; i ++) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        cout << a[(((n * 2) + 1) / 2 )] - a[(((n * 2) + 1) / 2) - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (int i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

ll ans[N];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    ll j = 0;
    while (t -- ){
        ll n;
        cin >> n;
        ll a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        cout << a[(((n * 2) + 1) / 2 )] - a[(((n * 2) + 1) / 2) - 1] << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define foo(i, n) for (ll i = 0; i < n * 2; i ++)
#define rep(i, n) for (int i = 1; i < n; i ++)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e6 + 7;
const int INF = 2e18;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t -- ){
        ll n;
        cin >> n;
        ll k = n * 2;
        int a[n];
        foo (i, n) {
            cin >> a[i];
        }
        sort(a, a + n * 2);
        ll mid = ((n * 2) + 1) / 2 ;
        cout << a[mid] - a[mid - 1] << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n; cin>>n;
    ll ans = INT_MAX;
    ll diff = 0;
    vector<ll> v(2*n);
    int k = n;
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        diff = v[n] - v[i];
        ans = min(diff,ans);
    }
    cout<<ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n; cin>>n;
    vector<ll> v(2*n);
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    if(n%2!=0)
        cout<<abs(v[n]-v[n-1]);
    else
        cout<<abs(v[n]-v[n-2]);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n; cin>>n;
    ll ans = INT_MAX;
    ll diff = 0;
    vector<ll> v(2*n);
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    for(int i=0;i<2*n-1;i++){
        int j=2*n-1;
        diff = abs(v[i]-v[j]);
        ans = min(ans,diff);
    }
    cout<<ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n; cin>>n;
    vector<ll> v(2*n);
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    if(n%2!=0)
        cout<<abs(v[n]-v[n-1])<<endl;
    else
        cout<<abs(v[n+1]-v[n-2])<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n; cin>>n;
    ll ans = INT_MAX;
    ll diff = 0;
    vector<ll> v(2*n);
    int k = n;
    for(auto &i:v) cin>>i;
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        diff = v[i+(k--)] - v[i];
        //cout<<" K "<<k<<endl;
        ans = min(diff,ans);
    }
    cout<<ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}


#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int t;
    cin>>t;
    for(int r=0;r<t;r++)
    {
        int a;
        ll ss[11111];
       cin>>a;
        for(int i=1;i<=2*a;i++)
        {
            scanf("%lld",&ss[i]);
        }
        for(int i=1;i<=a+1;i++)
        {

            for(int j=2*a;j>=i;j--)
            {
                if(ss[j]<ss[j-1])
                {
                    int c=ss[j];
                    ss[j]=ss[j-1];
                    ss[j-1]=c;
                }
            }
        }
        printf("%d\n",ss[a+1]-ss[a]);
    }
}


#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int a;
int ss[200010];
 int t;
int main()
{
    scanf("%d",&t);
    for(int r=0;r<t;r++)
    {
        scanf("%d",&a);
        a<<=1;
        for(int i=1;i<=a;i++)
        {
            scanf("%d",&ss[i]);
        }
        sort(ss+1,ss+1+a);
        printf("%d\n",ss[a/2+1]-ss[a/2]);
    }
}


#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int a;
int ss[11111];
 int t;
int main()
{
    scanf("%d",&t);
    for(int r=0;r<t;r++)
    {
        scanf("%d",&a);
        a<<=1;
        for(int i=1;i<=a;i++)
        {
            scanf("%d",&ss[i]);
        }
        sort(ss+1,ss+1+a);
        printf("%d\n",ss[a/2+1]-ss[a/2]);
    }
}


#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int t;
    cin>>t;
    for(int r=0;r<t;r++)
    {
        int a;
        int ss[11111];
        cin>>a;
        a<<=1;
        for(int i=1;i<=a;i++)
        {
            scanf("%d",&ss[i]);
        }
        sort(ss+1,ss+1+a);
        printf("%d\n",ss[a/2+1]-ss[a/2]);
    }
}


#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int t;
    cin>>t;
    for(int r=0;r<t;r++)
    {
        int a,ss[10001];
        cin>>a;
        for(int i=1;i<=2*a;i++)
        {
            cin>>ss[i];
        }
        sort(ss+1,ss+1+2*a);
        printf("%d\n",ss[a+1]-ss[a]);
    }
}