#include<bits/stdc++.h>
using namespace std;
int vis[1000005];
int n;
void dfs(int i)
{
if(i>n)
return;
vis[i]=1;
if(!vis[i+4])
dfs(i+4);
if(!vis[i+7])
dfs(i+7);
}
int main()
{
scanf("%d",&n);
memset(vis,0,sizeof(vis));
dfs(0);
set<int> s;
//cout<<vis[n]<<"ab\n";
//cout<<"abc";
for(int i=1;i<=n;i++)
{
//cout<<2;
if(vis[i]==1)
{
s.insert(i);
//cout<<i<<' ';
}
}
if(s.find(n)==s.end())
{
cout<<-1;
return 0;
}
vector<int> v;
while(n>0)
{
// cout<<n;
if(s.find(n-7)!=s.end())
{
v.push_back(7);
n-=7;
continue;
}
if(s.find(n-4)!=s.end())
{
v.push_back(4);
n-=4;
}
}
sort(v.begin(),v.end());
for(int i=0;i<v.size();i++)
printf("%d",v[i]);
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IHZpc1sxMDAwMDA1XTsKaW50IG47CnZvaWQgZGZzKGludCBpKQp7CiAgaWYoaT5uKQogICAgcmV0dXJuOwogIHZpc1tpXT0xOwogIGlmKCF2aXNbaSs0XSkKICBkZnMoaSs0KTsKICBpZighdmlzW2krN10pCiAgZGZzKGkrNyk7Cn0gCmludCBtYWluKCkKewogIHNjYW5mKCIlZCIsJm4pOwogIG1lbXNldCh2aXMsMCxzaXplb2YodmlzKSk7CiAgZGZzKDApOwogIHNldDxpbnQ+IHM7CiAgLy9jb3V0PDx2aXNbbl08PCJhYlxuIjsKICAvL2NvdXQ8PCJhYmMiOwogIGZvcihpbnQgaT0xO2k8PW47aSsrKQogIHsKICAgIC8vY291dDw8MjsKICAgIGlmKHZpc1tpXT09MSkKICAgIHsKICAgICAgcy5pbnNlcnQoaSk7CiAgICAgIC8vY291dDw8aTw8JyAnOwogICAgfQogIH0KICBpZihzLmZpbmQobik9PXMuZW5kKCkpCiAgewogICAgY291dDw8LTE7CiAgICByZXR1cm4gMDsKICB9CiAgdmVjdG9yPGludD4gdjsKICB3aGlsZShuPjApCiAgewogICAvLyBjb3V0PDxuOwogICAgaWYocy5maW5kKG4tNykhPXMuZW5kKCkpCiAgICB7CiAgICAgIHYucHVzaF9iYWNrKDcpOwogICAgICBuLT03OwogICAgICBjb250aW51ZTsKICAgIH0KICAgIGlmKHMuZmluZChuLTQpIT1zLmVuZCgpKQogICAgewogICAgICB2LnB1c2hfYmFjayg0KTsKICAgICAgbi09NDsKICAgIH0KICB9CiAgc29ydCh2LmJlZ2luKCksdi5lbmQoKSk7CiAgZm9yKGludCBpPTA7aTx2LnNpemUoKTtpKyspCiAgICBwcmludGYoIiVkIix2W2ldKTsKICByZXR1cm4gMDsKfQ==