#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    while(n--){
    	ll x;
    	cin>>x;
    	ll numDie = ceil(1.0*x/21);
    	ll totSum = numDie*21;
    	if(numDie > 1){
            totSum -= (numDie-1)*7 ;
            numDie = 1;
    	}

        int flag = 0;
        for(int i = 1; i <= 6; i++){
        	if((totSum-i) == x)
        		flag = 1;
        }

        if(flag)
        	cout<<"YES\n";
        else
        	cout<<"NO\n";

    }
    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    vector<ll> nums(n);
    for0(i, n)
       cin>>nums[i];

    vi ans(n);
    for(int i = 0; i < n; i++){
    	ll numDie = ceil(1.0*nums[i]/21);
    	ll totSum = numDie*21;
        totSum -= (numDie-1)*7;
        numDie = 1;

        int flag = 0;
        for(int j = 1; j <= 6; j++){
        	if((totSum-j) == nums[i])
        		flag = 1;
        }

        ans[i] = flag;
    }

    for(int l: ans){
    	if(l)
    		cout<<"YES\n";
    	else
    		cout<<"NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    vector<ll> nums(n);
    for0(i, n)
       cin>>nums[i];

    vi ans(n);
    for(int i = 0; i < n; i++){

        int flag = 0;
        for(int j = 1; j <= 6; j++){
        	if((nums[i]+j)%7 == 0){
        		ll temp = (nums[i]+j)/7;
        		temp--;
        		if(temp%2 == 0)
        			flag = 1;
        	}
        }

        ans[i] = flag;
    }

    for(int l: ans){
    	if(l)
    		cout<<"YES\n";
    	else
    		cout<<"NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    vector<ll> nums(n);
    for0(i, n)
       cin>>nums[i];

    vi ans(n);
    for(int i = 0; i < n; i++){
        if(nums[i] < 21){
            if(nums[i] >= 15 && nums[i] <= 20)
                ans[i] = 1;

            continue;
        }

        ll temp = 1;
        for(int j = 1; j <= 6; j++){
        	if((nums[i]+j)%7 == 0){
        		temp = (nums[i]+j)/7;
        		temp--;
        		break;
        	}
        }

        if(temp%2 == 0)
           ans[i] = 1;
    }

    for(int l: ans){
    	if(l)
    		cout<<"YES\n";
    	else
    		cout<<"NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    vector<ll> nums(n);
    for0(i, n)
       cin>>nums[i];

    vi ans(n);
    for(int i = 0; i < n; i++){
    	ll numDie = ceil(1.0*nums[i]/21);
    	ll totSum1 = numDie*21;
    	ll totSum2 = (numDie+1)*21;
        totSum1 -= (numDie-1)*7;
        totSum2 -= (numDie)*7;

        int flag = 0;
        for(int j = 1; j <= 6; j++){
        	if(((totSum1-j) == nums[i]) || ((totSum2-j) == nums[i]))
        		flag = 1;
        }

        ans[i] = flag;
    }

    for(int l: ans){
    	if(l)
    		cout<<"YES\n";
    	else
    		cout<<"NO\n";
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define endl '\n'
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x%14ll;
        if(q >=1ll && q <= 6ll)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x % 14ll;
        if(q >= 1ll && q <= 6ll)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define endl '\n'
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x % 14ll;
        if(q >=1ll && q <= 6ll)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define endl '\n'
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    ll x;
    while(n--)
    {
        cin>>x;
        ll q1 = x-1;
        ll q2 = x-2;
        ll q3 = x-3;
        ll q4 = x-4;
        ll q5 = x-5;
        ll q6 = x-6;

        if(q1%14==0 or q2%14==0 or q3%14==0 or q4%14==0 or q5%14==0 or q6%14==0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
// #define boost ios_base::sync_with_stdio(0),cin.tie(0)

int main()
{
    // boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x % 14ll;
        if(q >= 1ll && q <= 6ll && x>=15ll)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define endl '\n'
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x%14;
        if(q >=1 && q <= 6)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
const int MOD = 1000000007;
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
#define pb push_back
#define mp make_pair
#define pll pair< int, int >
#define endl '\n'
#define X first
#define Y second
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

int main()
{
    boost;
    int n;
    cin>>n;
    while(n--)
    {
        ll x;
        cin>>x;
        ll q = x%14ll;
        if(q >=1ll && q <= 6ll)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
	fastio();
	unsigned ll t,n,i;
	cin>>t;
	while(t--)
	{
		int flag=0;
		cin>>n;
		unsigned ll temp=n/21+1;

	for(i=1;i<=6;i++)
	{
		if((temp*21-i-7*(temp-1))==n)
		{
			//cout<<i;
			flag++;
			break;
		}

	}
	if(flag)
		{cout<<"YES"<<endl;}
	else
	{
		cout<<"NO"<<endl;
	}

	}

return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
    fastio();
  ll i,t,temp,n;
  int flag=0;
  cin>>t;
  while(t--)
  {flag=0;
      cin>>n;
      temp=n/21+1;
      for(i=0;i<21;i++)
      {if((temp+i)*14-n+7>0 && (temp+i)*14-n+7<=6)
      {
          flag=1;
      }}
      if(flag)
      cout<<"YES"<<endl;
      else
      {
          cout<<"NO"<<endl;
      }
  }
return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
	fastio();
	unsigned ll t,n,i;
	cin>>t;
	while(t--)
	{
	  unsigned ll int flag=0;
		cin>>n;
		unsigned ll temp=(n/21)+1;

		//cout<<temp;

	/*for(i=1;i<=6;i++)
	{
		if((temp*21-i-7*(temp-1))==n)
		{
			//cout<<i;
			flag++;
			//break;
		}

	}*/
		if(14*temp-n+7>0 && 14*temp-n+7<=6)
		{
			flag=1;
		}
	if(flag)
		{cout<<"YES"<<endl;}
	else
	{
		cout<<"NO"<<endl;
	}

	}

return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
    fastio();
  ll i,t,temp,n;
  int flag=0;
  cin>>t;
  while(t--)
  {flag=0;
      cin>>n;
      temp=n/21+1;
      for(i=0;i<10000;i++)
      {if((temp+i)*14-n+7>0 && (temp+i)*14-n+7<=6)
      {
          flag=1;
      }}
      if(flag)
      cout<<"YES"<<endl;
      else
      {
          cout<<"NO"<<endl;
      }
  }
return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
	fastio();
  ll i,t,temp,n;
  cin>>t;
  while(t--)
  {
  	cin>>n;
  	temp=n/21+1;
  	if(temp*14-n+7>0 && temp*14-n+7<=6)
  	{
  		cout<<"YES"<<endl;
  	}
  	else
  	{
  		cout<<"NO"<<endl;
  	}
  }
return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
    fastio();
  ll i,t,temp,n;
  int flag=0;
  cin>>t;
  while(t--)
  {ll N;
      cin>>N;
      if(N%14>0&&N%14<7&&N/14>=1)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
  }
return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
	fastio();
	unsigned ll t,n,i;
	cin>>t;
	while(t--)
	{
	  unsigned ll int flag=0;
		cin>>n;
		unsigned ll temp=(n/21)+1;

		//cout<<temp;

	/*for(i=1;i<=6;i++)
	{
		if((temp*21-i-7*(temp-1))==n)
		{
			//cout<<i;
			flag++;
			//break;
		}

	}*/
		unsigned ll p=14*temp-n+7;
		if(p>=1 && p<=6)
		{
			flag=1;
		}
	if(flag)
		{cout<<"YES"<<endl;}
	else
	{
		cout<<"NO"<<endl;
	}

	}

return 0;

}


#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define fone for(i=0;i<n;i++)
#define endl "\n"
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 5000*100+1;
const ll N2      = 1000*1000;
const ld PI  = 3.14159265;
const ll R   = 250;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
    }

int main ()
{
    fastio();
  ll i,t,temp,n;
  int flag=0;
  cin>>t;
  while(t--)
  {flag=0;
      cin>>n;
      temp=n/21+1;
      for(i=0;i<1000000;i++)
      {if((temp+i)*14-n+7>0 && (temp+i)*14-n+7<=6)
      {
          flag=1;
      }}
      if(flag)
      cout<<"YES"<<endl;
      else
      {
          cout<<"NO"<<endl;
      }
  }
return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define  ll  unsigned long long
#define  pb push_back
#define  pi  pair<int,int>
const int N=2e5+2;
string s;
map<int,int>mp;
int main()
{
    ll t,i,j,n,m,c,e,l;
    cin>>t;
    for(i=0; i<t; i++)
    {
        cin>>m;
        if(m>=15 && m<=20)
        {
            cout<<"YES\n";
        }
        else if(m%10==4 || m%10==9)
        {
                cout<<"YES\n";
        }
        else if(m<15)
        {
            cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define  ll  unsigned long long
#define  pb push_back
#define  pi  pair<int,int>
const int N=2e5+2;
string s;
map<int,int>mp;
int main()
{
    ll t,i,j,n,m,c,e,l;
    cin>>t;
    for(i=0; i<t; i++)
    {
        cin>>m;
        if(m>=15 && m<=20)
        {
            cout<<"YES\n";
        }
        else if(m%10==4 || m%10==9)
        {
                cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define  ll  unsigned long long
#define  pb push_back
#define  pi  pair<int,int>
const int N=2e5+2;
string s;
map<int,int>mp;
int main()
{
    ll t,i,j,n,m,c,e,l;
    cin>>t;
    for(i=0; i<t; i++)
    {
        cin>>m;
        if(m>=15 && m<=20)
        {
            cout<<"YES\n";
        }
        else if(m>20)
        {
            c=1;
            c+=ceil((m-20)*1.0/15);
            l=(c-1)*13+15;
            if(m>=l)
            {
                cout<<"YES\n";
            }
            else
            {
                cout<<"NO\n";
            }
        }
        else if(m<15)
        {
            cout<<"NO\n";
        }
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;

const int maxn=2000050;
int a1,a2,a3,a4;
int ans[maxn];

int main(){
    int i,j,k;
    while(scanf("%d%d%d%d",&a1,&a2,&a3,&a4)!=EOF){
        if(a3==a4){
            if(a1>a3){
                while(a1-1>a3){
                    printf("4");
                    a1--;
                }
                while(a3>0){
                    printf("47");
                    a3--;
                }
                while(a2>a4){
                    printf("7");
                    a2--;
                }
                printf("4");
            }else if(a2>a4){
                while(a2-1>a3){
                    printf("7");
                    a2--;
                }
                while(a4>0){
                    printf("74");
                    a4--;
                }
                while(a1>a3){
                    printf("4");
                    a1--;
                }
                printf("7");
            }else
                printf("-1");
        }else if(a3==a4+1){
            while(a1>a3){
                printf("4");
                a1--;
            }
            while(a3>0){
                printf("47");
                a3--;
            }
            while(a2>a3){
                printf("7");
                a2--;
            }
        }else if(a4==a3+1){
            while(a2>a4){
                printf("7");
                a2--;
            }
            while(a2>0){
                printf("74");
                a2--;
            }
            while(a1>a4){
                printf("4");
                a1--;
            }
        }
        else
            printf("-1");
        puts("");
    }
    return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector< pair<int,int> > h;
int main(){
//                               Last Change:  2012-01-22 16:46:06
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(c-d)>1){
		puts("-1");
		return 0;
	}
	h.clear();
	if(c>d||(c==d&&a>c)){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(4,1));
			h.push_back(make_pair(7,1));
		}
		a-=c,b-=c;
		if(c==d)a-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(4,1));
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
	}
	else {
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(7,1));
			h.push_back(make_pair(4,1));
		}
		a-=c,b-=c;
		if(c==d)b-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(7,1));
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
	}
	for(int i=0;i<h.size();++i)
		for(int j=0;j<h[i].second;++j)
			putchar('0'+h[i].first);
	puts("");
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector< pair<int,int> > h;
int main(){
//                                    Last Change:  2012-01-22 16:49:18
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(c-d)>1){
		puts("-1");
		return 0;
	}
	h.clear();
	if(c>d||(c==d&&a>c)){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(4,1));
			h.push_back(make_pair(7,1));
		}
		a-=c,b-=c;
		if(c==d)a-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(4,1));
		bool f1=0,f2=0;
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				f1=1;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				f2=1;
				break;
			}
		if(!f1){puts("-1");return 0;}
		if(!f2){puts("-1");return 0;}
	}
	else {
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(7,1));
			h.push_back(make_pair(4,1));
		}
		a-=c,b-=c;
		if(c==d)b-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(7,1));
		bool f1=0,f2=0;
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				f1=1;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				f2=1;
				break;
			}
		if(!f1){puts("-1");return 0;}
		if(!f2){puts("-1");return 0;}
	}
	for(int i=0;i<h.size();++i)
		for(int j=0;j<h[i].second;++j)
			putchar('0'+h[i].first);
	puts("");
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector< pair<int,int> > h;
int main(){
//            Last Change:  2012-01-22 16:39:58
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(c-d)>1){
		puts("-1");
		return 0;
	}
	h.clear();
	if(c>=d){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(4,1));
			h.push_back(make_pair(7,1));
		}
		a-=c,b-=c;
		if(c==d)a-=1;
		if(a<0||b<0){puts("-1");return 0;}
		for(int i=0;i<2*c;++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1;i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
		if(c==d)h.push_back(make_pair(4,1));
	}
	else if(c<d){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(7,1));
			h.push_back(make_pair(4,1));
		}
		a-=c,b-=c;
		if(a<0||b<0){puts("-1");return 0;}
		for(int i=0;i<2*c;++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1;i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
	}
	for(int i=0;i<h.size();++i)
		for(int j=0;j<h[i].second;++j)
			putchar('0'+h[i].first);
	puts("");
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector< pair<int,int> > h;
int main(){
//                   Last Change:  2012-01-22 16:41:47
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(c-d)>1){
		puts("-1");
		return 0;
	}
	h.clear();
	if(c>=d){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(4,1));
			h.push_back(make_pair(7,1));
		}
		a-=c,b-=c;
		if(c==d)a-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(4,1));
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
	}
	else if(c<d){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(7,1));
			h.push_back(make_pair(4,1));
		}
		a-=c,b-=c;
		if(a<0||b<0){puts("-1");return 0;}
		for(int i=0;i<2*c;++i)
			if(h[i].first==4){
				h[i].second+=a;
				break;
			}
		for(int i=2*c-1;i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				break;
			}
	}
	for(int i=0;i<h.size();++i)
		for(int j=0;j<h[i].second;++j)
			putchar('0'+h[i].first);
	puts("");
	return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
vector< pair<int,int> > h;
int main(){
//                                              Last Change:  2012-01-22 16:57:32
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(abs(c-d)>1){
		puts("-1");
		return 0;
	}
	h.clear();
	if(c>d||(c==d&&a>c)){
		for(int i=1;i<=c;++i){
			h.push_back(make_pair(4,1));
			h.push_back(make_pair(7,1));
		}
		a-=c,b-=c;
		if(c==d)a-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(4,1));
		bool f1=0,f2=0;
		for(int i=0;i<2*c+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				f1=1;
				break;
			}
		for(int i=2*c-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				f2=1;
				break;
			}
		if(a&&!f1){puts("-1");return 0;}
		if(b&&!f2){puts("-1");return 0;}
	}
	else {
		for(int i=1;i<=d;++i){
			h.push_back(make_pair(7,1));
			h.push_back(make_pair(4,1));
		}
		a-=d,b-=d;
		if(c==d)b-=1;
		if(a<0||b<0){puts("-1");return 0;}
		if(c==d)h.push_back(make_pair(7,1));
		bool f1=0,f2=0;
		for(int i=0;i<2*d+(c==d);++i)
			if(h[i].first==4){
				h[i].second+=a;
				f1=1;
				break;
			}
		for(int i=2*d-1+(c==d);i>=0;--i)
			if(h[i].first==7){
				h[i].second+=b;
				f2=1;
				break;
			}
		if(a&&!f1){puts("-1");return 0;}
		if(b&&!f2){puts("-1");return 0;}
	}
	for(int i=0;i<h.size();++i)
		for(int j=0;j<h[i].second;++j)
			putchar('0'+h[i].first);
	puts("");
	return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";
   if(cnt47 == cnt74) {
      if(cnt47 == 1) {
         if(cnt4 > 1) {
            res+="474";
            cnt4-=2;
            cnt7--;
         } else {
            res+="747";
            cnt4--;
            cnt7-=2;
         }
      } else {
         for(int i = 0; i < cnt47; ++i) {
           res+="47";
           cnt4--;
           cnt7--;
           if(i > 0) cnt74--;
         }
         for(int i = 0; i < cnt74; ++i) {
            if(i > 0) {
               res+="74";
               cnt4--;
               cnt7--;
            } else {
               if(cnt4-1 >= 0) {
                  cnt4--;
                  res+="4";
               } else if(cnt7-1 >= 0) {
                  cnt7--;
                  res="7"+res;
               }
            }
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";

   if(cnt47 == cnt74) {
      if(cnt47 == 1) {
         if(cnt4 > 1) {
            res+="474";
            cnt4-=2;
            cnt7--;
         } else {
            res+="747";
            cnt4--;
            cnt7-=2;
         }
      } else {
         for(int i = 0; i < cnt47; ++i) {
           res+="47";
           cnt4--;
           cnt7--;
           if(i > 0) cnt74--;
         }
         for(int i = 0; i < cnt74; ++i) {
            res+="74";
            cnt4--;
            cnt7--;
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   //printf("c4=%d c7=%d c47=%d c74=%d\n",cnt4,cnt7,cnt47,cnt74);
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";
   if(cnt47 == cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
        if(i > 0) cnt74--;
      }
      for(int i = 0; i < cnt74; ++i) {
         if(i > 0) {
            res+="74";
            cnt4--;
            cnt7--;
         } else {
            if(cnt4-1 >= 0) {
               cnt4--;
               res+="4";
            } else if(cnt7-1 >= 0) {
               cnt7--;
               res="7"+res;
            } else {
               return "-1";
            }
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";

   if(cnt47 == cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
        if(i > 0) cnt74--;
      }
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";
   if(cnt47 == cnt74) {
      if(cnt47 == 1) {
         if(cnt4 > 1) {
            res+="474";
            cnt4-=2;
            cnt7--;
         } else {
            res+="747";
            cnt4--;
            cnt7-=2;
         }
      } else {
         for(int i = 0; i < cnt47; ++i) {
           res+="47";
           cnt4--;
           cnt7--;
           if(i > 0) cnt74--;
         }
         for(int i = 0; i < cnt74; ++i) {
            if(i > 0) {
               res+="74";
               cnt4--;
               cnt7--;
            } else {
               if(cnt4-1 >= 0) {
                  cnt4--;
                  res+="4";
               } else if(cnt7-1 >= 0) {
                  cnt7--;
                  res="7"+res;
               } else {
                  return "-1";
               }
            }
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   printf("c4=%d c7=%d c47=%d c74=%d\n",cnt4,cnt7,cnt47,cnt74);
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";
   if(cnt47 == cnt74) {
      if(cnt47 == 1) {
         if(cnt4 > 1) {
            res+="474";
            cnt4-=2;
            cnt7--;
         } else {
            res+="747";
            cnt4--;
            cnt7-=2;
         }
      } else {
         if(cnt7 > cnt4) {
            for(int i = 0; i < cnt74; ++i) {
              res+="74";
              cnt4--;
              cnt7--;
              if(i > 0) cnt47--;
            }
            for(int i = 0; i < cnt47; ++i) {
               if(i > 0) {
                  res+="47";
                  cnt4--;
                  cnt7--;
               } else {
                  res+="7";
                  cnt7--;
               }
            }
         } else {
            for(int i = 0; i < cnt47; ++i) {
              res+="47";
              cnt4--;
              cnt7--;
              if(i > 0) cnt74--;
            }
            for(int i = 0; i < cnt74; ++i) {
               if(i > 0) {
                  res+="74";
                  cnt4--;
                  cnt7--;
               } else {
                  res+="4";
                  cnt4--;
               }
            }
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int c4, int c7, int c47, int c74) {
   string res = "";
   for(int i = 0; i < c47; ++i) {
      res+="47";
      c4--;
      c7--;
      if(i > 0) c74--;
   }
   if(c4 < 0 || c7 < 0 || c74 < 0) return "-1";
   for(int i = 0; i < c74; ++i) {
      res+="74";
      c4--;
      c7--;
   }
   if(c4 < 0 || c7 < 0) return "-1";
   for(int i = 0; i < c4; ++i)
      res = "4" + res;
   for(int i = 0; i < c7; ++i)
      res+="7";

   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <bitset>
#include <deque>
#include <numeric>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <sys/time.h>

using namespace std;

#define DEBUG(x) cout << #x << ": " << x << endl
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
template <typename T> string tostr(const T& t) { ostringstream os; os<<t; return os.str(); }

string solve(int cnt4, int cnt7, int cnt47, int cnt74) {
   int p1, p2;
   string res = "";
   if(abs(cnt47 - cnt74) > 1)
      return "-1";
   if(cnt47 == cnt74) {
      if(cnt47 == 1) {
         if(cnt4 > 1) {
            res+="474";
            cnt4-=2;
            cnt7--;
         } else {
            res+="747";
            cnt4--;
            cnt7-=2;
         }
      } else {
         for(int i = 0; i < cnt47; ++i) {
           res+="47";
           cnt4--;
           cnt7--;
           if(i > 0) cnt74--;
         }
         for(int i = 0; i < cnt74; ++i) {
            if(i > 0) {
               res+="74";
               cnt4--;
               cnt7--;
            } else {
               if(cnt4-1 >= 0) {
                  cnt4--;
                  res+="4";
               } else if(cnt7-1 >= 0) {
                  cnt7--;
                  res="7"+res;
               } else {
                  return "-1";
               }
            }
         }
      }
   } else if(cnt47 > cnt74) {
      for(int i = 0; i < cnt47; ++i) {
        res+="47";
        cnt4--;
        cnt7--;
      }
   } else {
      for(int i = 0; i < cnt74; ++i) {
         res+="74";
         cnt4--;
         cnt7--;
      }
   }
   if(cnt4 < 0 || cnt7 < 0)
      return "-1";
   string rem4 = string(cnt4, '4');
   string rem7 = string(cnt7, '7');
   p1 = res.find("4");
   res = res.substr(0, p1) + rem4 + res.substr(p1);
   p2 = res.rfind("7");
   res = res.substr(0, p2) + rem7 + res.substr(p2);
   return res;
}

int main(int argc, char *argv[]) {
   string res = "";
   int c4, c7, c47, c74;
   cin >> c4 >> c7 >> c47 >> c74;
   cout << solve(c4,c7,c47,c74) << endl;
   return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>

using namespace std;

int a, b, c, d;
string s = "\0";

bool check ()
{
	if (a < 0 || b < 0 || d < 0 || c < 0)
	{
		printf ("-1");
		exit (0);
	}
}

int main()
{
 #ifndef ONLINE_JUDGE
       freopen("input.txt","rt",stdin);
       freopen("output.txt","wt",stdout);
 #endif
	scanf ("%d%d%d%d", &a, &b, &c, &d);
	int i = 1;
	while (c)
	{
		s += "47";
		a--;
		b--;
		if (i != 1) d--;
		c--;
		i++;
	}
	check ();
	/*if (d && s[s.length () - 1] == '7')
	{
		d--;
		a--;
		s += '4';
	}
	char beg = '\0';
	if (d && s[0] == '4')
	{
		d--;
		b--;
		beg = '7';
	}
	check ();	*/
	i = 1;
	while (d)
	{
		s += "74";
		if (i != 1) c--;
		d--;
		a--;
		i++;
		b--;
	}
	check ();
//	if (beg == '7') printf ("%c", beg);
	for (int i = 0, l = s.length (); i < l; i++)
	{
		if (s[i] == '4')
		{
			while (a)
			{
				printf ("4");
				a--;
			}
		}
		if (s[i] == '7' && i + 2 >= l)
		{
			while (b)
			{
				printf ("7");
				b--;
			}
		}
		printf ("%c", s[i]);
	}
return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
typedef long long ll;

#define gc getchar
int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }

int a[4]; // 0, 1, 2, 3

int main () {
    int i, j, tcc, tc = 1 << 28;
    for (tcc = 0; tcc < tc; tcc++) {
        for (i = 0; i < 4; i++) a[i] = getint();
        if (abs(a[2] - a[3]) > 1) {
            puts("-1");
            continue;
        }
        bool ok = 1;
        string res, s4, s7;
        int n4 = 0, n7 = 0;
        if (a[2] > a[3]) for (i = 0; i < a[2]; i++) res += "47";
        if (a[2] < a[3]) for (i = 0; i < a[2]; i++) res += "74";
        if (a[2] == a[3]) {
            if (a[0] >= a[1]) { for (i = 0; i < a[2]; i++) res += "47"; res += "4"; }
            else { for (i = 0; i < a[2]; i++) res += "74"; res += "7"; }
        }
        for (i = 0; i < res.size(); i++) {
            if (res[i] == '4') a[0]--;
            if (res[i] == '7') a[1]--;
        }
        if (a[0] < 0 or a[1] < 0) ok = 0;
        for (i = 0; i < a[0]; i++) s4 += '4';
        for (i = 0; i < a[1]; i++) s7 += '7';
        string str;
        for (i = 0; i < res.size(); i++) {
            str += res[i];
            if (res[i] == '4') str += s4, s4 = "";
            if (res[i] == '7') str += s7, s7 = "";
        }
        if (ok and s4 == "" and s7 == "") {
            puts(str.c_str());
        } else {
            puts("-1");
        }
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
typedef long long ll;

#define gc getchar
int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }

int a[4]; // 0, 1, 2, 3

int main () {
    int i, j, tcc, tc = 1 << 28;
    for (tcc = 0; tcc < tc; tcc++) {
        for (i = 0; i < 4; i++) a[i] = getint();
        if (abs(a[2] - a[3]) > 1) {
            puts("-1");
            continue;
        }
        bool ok = 1;
        string res, s4, s7;
        int n4 = 0, n7 = 0;
        if (a[2] > a[3]) for (i = 0; i < a[2]; i++) res += "47";
        if (a[2] < a[3]) for (i = 0; i < a[3]; i++) res += "74";
        if (a[2] == a[3]) {
            if (a[0] >= a[1]) { for (i = 0; i < a[2]; i++) res += "47"; res += "4"; }
            else { for (i = 0; i < a[2]; i++) res += "74"; res += "7"; }
        }
        for (i = 0; i < res.size(); i++) {
            if (res[i] == '4') a[0]--;
            if (res[i] == '7') a[1]--;
        }
        if (a[0] < 0 or a[1] < 0) ok = 0;
        for (i = 0; i < a[0]; i++) s4 += '4';
        for (i = 0; i < a[1]; i++) s7 += '7';
        int pos4 = ~0, pos7 = ~0;
        for (i = 0; i < res.size(); i++) {
            if (res[i] == '4' and !~pos4) pos4 = i;
            if (res[i] == '7' and !~pos7) pos7 = i;
        }
        if (ok and ~pos4 and ~pos7) {
            for (i = 0; i < res.size(); i++) {
                putchar(res[i]);
                if (i == pos4) for (j = 0; j < s4.size(); j++) putchar('4');

                if (i == pos7) for (j = 0; j < s7.size(); j++) putchar('7');
            }
            puts("");
        } else {
            puts("-1");
        }
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
typedef long long ll;

#define gc getchar
int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }

int a[4]; // 0, 1, 2, 3

int main () {
    int i, j, tcc, tc = 1 << 28;
    for (tcc = 0; tcc < tc; tcc++) {
        for (i = 0; i < 4; i++) a[i] = getint();
        if (abs(a[2] - a[3]) > 1) {
            puts("-1");
            continue;
        }
        bool ok = 1;
        string res, s4, s7;
        int n4 = 0, n7 = 0;
        if (a[2] > a[3]) for (i = 0; i < a[2]; i++) res += "47";
        if (a[2] < a[3]) for (i = 0; i < a[3]; i++) res += "74";
        if (a[2] == a[3]) {
            if (a[0] >= a[1]) { for (i = 0; i < a[2]; i++) res += "47"; res += "4"; }
            else { for (i = 0; i < a[2]; i++) res += "74"; res += "7"; }
        }
        for (i = 0; i < res.size(); i++) {
            if (res[i] == '4') a[0]--;
            if (res[i] == '7') a[1]--;
        }
        if (a[0] < 0 or a[1] < 0) ok = 0;
        for (i = 0; i < a[0]; i++) s4 += '4';
        for (i = 0; i < a[1]; i++) s7 += '7';
        int pos4 = ~0, pos7 = ~0;
        for (i = 0; i < res.size(); i++) {
            if (res[i] == '4' and !~pos4) pos4 = i;
            if (res[i] == '7') pos7 = max(pos7, i);
        }
        if (ok and ~pos4 and ~pos7) {
            for (i = 0; i < res.size(); i++) {
                putchar(res[i]);
                if (i == pos4) for (j = 0; j < s4.size(); j++) putchar('4');

                if (i == pos7) for (j = 0; j < s7.size(); j++) putchar('7');
            }
            puts("");
        } else {
            puts("-1");
        }
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
typedef long long ll;

#define gc getchar
int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }

int a[4]; // 0, 1, 2, 3

int n4, n7;
string solve(const string& in) {
    int i, j, b[4];
    for (i = 0; i < 4; i++) b[i] = a[i];
    for (i = 0; i < in.size(); i++) {
        if (in[i] == '4') b[0]--;
        if (in[i] == '7') b[1]--;
    }
    if (b[0] < 0 or b[1] < 0) return "~";
    n4 = n7 = ~0;
    for (i = 0; i < in.size(); i++) {
        if (in[i] == '4' and !~n4) n4 = i;
        if (in[i] == '7') n7 = max(n7, i);
    }
    if (!~n4 or !~n7) return "~";
    string res;
    for (i = 0; i < in.size(); i++) {
        res += in[i];
        if (i == n4) for (j = 0; j < b[0]; j++) res += '4';
        if (i == n7) for (j = 0; j < b[1]; j++) res += '7';
    }
    return res;
}

int main () {
    int i, j, tcc, tc = 1 << 28;
    for (tcc = 0; tcc < tc; tcc++) {
        for (i = 0; i < 4; i++) a[i] = getint();
        if (abs(a[2] - a[3]) > 1) { puts("-1"); continue; }
        bool ok = 1;
        string res, s4, s7;
        int n4 = 0, n7 = 0;
        if (a[2] > a[3]) { for (i = 0; i < a[2]; i++) res += "47"; res = solve(res); }
        if (a[2] < a[3]) { for (i = 0; i < a[3]; i++) res += "74"; res = solve(res); }
        if (a[2] == a[3]) {
            for (i = 0; i < a[2]; i++) res += "47"; res += "4";
            res = solve(res);
            if (res == "~") {
                res = "";
                for (i = 0; i < a[2]; i++) res += "74"; res += "7";
                res = solve(res); if (res != "~") break;
            }
        }
        if (res == "~") puts("-1");
        else puts(res.c_str());
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <cctype>
#include <cfloat>
#include <climits>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
typedef long long ll;

#define gc getchar
int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; }

int a[4]; // 0, 1, 2, 3

int n4, n7;
string solve(const string& in) {
    int i, j, b[4];
    for (i = 0; i < 4; i++) b[i] = a[i];
    for (i = 0; i < in.size(); i++) {
        if (in[i] == '4') b[0]--;
        if (in[i] == '7') b[1]--;
    }
    if (b[0] < 0 or b[1] < 0) return "~";
    n4 = n7 = ~0;
    for (i = 0; i < in.size(); i++) {
        if (in[i] == '4' and !~n4) n4 = i;
        if (in[i] == '7') n7 = max(n7, i);
    }
    if (!~n4 or !~n7) return "~";
    string res;
    for (i = 0; i < in.size(); i++) {
        res += in[i];
        if (i == n4) for (j = 0; j < b[0]; j++) res += '4';
        if (i == n7) for (j = 0; j < b[1]; j++) res += '7';
    }
    return res;
}

int main () {
    int i, j, tcc, tc = 1 << 28;
    for (tcc = 0; tcc < tc; tcc++) {
        for (i = 0; i < 4; i++) a[i] = getint();
        if (abs(a[2] - a[3]) > 1) { puts("-1"); continue; }
        bool ok = 1;
        string res, s4, s7;
        int n4 = 0, n7 = 0;
        if (a[2] > a[3]) { for (i = 0; i < a[2]; i++) res += "47"; res = solve(res); }
        if (a[2] < a[3]) { for (i = 0; i < a[3]; i++) res += "74"; res = solve(res); }
        if (a[2] == a[3]) {
            for (i = 0; i < a[2]; i++) res += "47"; res += "4";
            res = solve(res);
            if (res == "~") {
                res = "";
                for (i = 0; i < a[2]; i++) res += "74"; res += "7";
                res = solve(res);
            }
        }
        if (res == "~") puts("-1");
        else puts(res.c_str());
    }
    return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

map<int,int> B;

int tp[302][301], s[301];

char ba[10001];
char bb[10001];

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					s[curr++] = '7'; a2--; a4--;
				}
			} else if( a4 == 2 ){
				s[curr++] = '7'; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
			for(int j = 0; j < a3; ++j){
				s[curr++] = '4';
				s[curr++] = '7';
			}
			a3 = 0;
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if(end4){
				s[curr++] = '4';
			}
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

map<int,int> B;

int tp[302][301], s[301];

char ba[10001];
char bb[10001];

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					s[curr++] = '7'; a2--; a4--;
				}
			} else if( a4 == 2 ){
				s[curr++] = '7'; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
			for(int j = 0; j < a3; ++j){
				s[curr++] = '4';
				s[curr++] = '7';
			}
			a3 = 0;
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if(end4){
				s[curr++] = '4';
			}
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool beg7 = false, end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					beg7 = true; a2--; a4--;
				}
			} else if( a4 == 2 ){
				beg7 = true; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 && a1 + 2*a3 + a2 + (beg7?1:0)+(end4?1:0) ==s.length() ){
				if(beg7)
					s[curr++] = '4';
				for(int j = 0; j < a1; ++j)
					s[curr++] = '4';
				for(int j = 0; j < a3; ++j){
					s[curr++] = '4';
					s[curr++] = '7';
				}
				a3 = 0;
				for(int j = 0; j < a2; ++j)
					s[curr++] = '7';
				if(end4){
					s[curr++] = '4';
				}

			} else ok = false;
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool beg7 = false, end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					beg7 = true; a2--; a4--;
				}
			} else if( a4 == 2 ){
				beg7 = true; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			if( a1 + 2*a3 + a2 + (beg7?1:0)+(end4?1:0) == a1+a2 ){
				if(beg7)
					s[curr++] = '4';
				for(int j = 0; j < a1; ++j)
					s[curr++] = '4';
				for(int j = 0; j < a3; ++j){
					s[curr++] = '4';
					s[curr++] = '7';
				}
				a3 = 0;
				for(int j = 0; j < a2; ++j)
					s[curr++] = '7';
				if(end4){
					s[curr++] = '4';
				}
			}
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool beg7 = false, end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					beg7 = true; a2--; a4--;
				}
			} else if( a4 == 2 ){
				beg7 = true; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			if( a1 >= 0 && a2 >= 0 && a4 == 0 && a1 + 2*a3 + a2 + (beg7?1:0)+(end4?1:0) ==s.length() ){
				if(beg7)
					s[curr++] = '4';
				for(int j = 0; j < a1; ++j)
					s[curr++] = '4';
				for(int j = 0; j < a3; ++j){
					s[curr++] = '4';
					s[curr++] = '7';
				}
				a3 = 0;
				for(int j = 0; j < a2; ++j)
					s[curr++] = '7';
				if(end4){
					s[curr++] = '4';
				}

			} else ok = false;
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


// CF.cpp: define el punto de entrada de la aplicaci?n de consola.
//

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
typedef std::pair<int,int> ii;
typedef long long int Int;
typedef unsigned long long int uInt;
typedef std::vector<int> vi;
typedef std::vector<ii> vii;
using namespace std;

int main(){
        #ifdef _DEBUG
                freopen("/home/Code/CodeForces/CF.txt","r",stdin);
        #endif
		int a1,a2,a3,a4;
		scanf("%d %d %d %d", &a1, &a2, &a3, &a4);
		string s(a1+a2,' ');
		int curr = 0;
		bool ok = true;
		bool beg7 = false, end4 = false;
		if( a3 > 0 ){
			a1 -= a3, a2-=a3, a4-=a3-1;
			if( a4 == 1 ){
				if( a1 > 0 ){
					a1--; end4 = true; a4--;
				} else {
					beg7 = true; a2--; a4--;
				}
			} else if( a4 == 2 ){
				beg7 = true; a2--; a4--;
				a1--; end4 = true; a4--;
			}
			if( a1 >= 0 && a2 >= 0 && a4 == 0 && a1 + 2*a3 + a2 + (beg7?1:0)+(end4?1:0) ==s.length() ){
				if(beg7)
					s[curr++] = '7';
				for(int j = 0; j < a1; ++j)
					s[curr++] = '4';
				for(int j = 0; j < a3; ++j){
					s[curr++] = '4';
					s[curr++] = '7';
				}
				a3 = 0;
				for(int j = 0; j < a2; ++j)
					s[curr++] = '7';
				if(end4){
					s[curr++] = '4';
				}

			} else ok = false;
		} else {
			for(int j = 0; j < a2; ++j)
				s[curr++] = '7';
			if( a2 > 0 && a1 > 0 )
				a4--;
			for(int j = 0; j < a1; ++j)
				s[curr++] = '4';
		}
		if( a1 >= 0 && a2 >= 0 && a3 == 0 && a4 == 0 ){
			printf( s.c_str() );
		} else {
			printf("-1\n");
		}
		fflush(stdout);
		return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long Int;

Int ABS(Int a)
{
    if (a<0)
    return a*-1;
    else
    return a;
}

int main()
{
    Int a1,a2,a3,a4;
    Int fours,sevens;
    Int i;

    scanf("%I64d %I64d %I64d %I64d",&a1,&a2,&a3,&a4);

    if ( ABS(a3-a4)>1 )
    {
        printf("-1\n");
        return 0;
    }

    if (a3>a4)
    {
        fours=a1-a3;
        sevens=a4-a2;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }
        for (i=1;i<=a3;i++)
        {
            printf("47");
        }
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
    }
    else if (a4>a3)
    {
        fours=a1-a3;
        sevens=a4-a2;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("74");

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-2;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }
    else if (a3==a4)
    {
        fours=a1-a3-1;
        sevens=a2-a4;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("4");
        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-1;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }

    printf("\n");

    return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long Int;

Int ABS(Int a)
{
    if (a<0)
    return a*-1;
    else
    return a;
}

int main()
{
    Int a1,a2,a3,a4;
    Int fours,sevens;
    Int i;

    scanf("%I64d %I64d %I64d %I64d",&a1,&a2,&a3,&a4);

    if ( ABS(a3-a4)>1 )
    {
        printf("-1\n");
        return 0;
    }

    if (a3>a4)
    {
        fours=a1-a3;
        sevens=a2-a3;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }
        for (i=1;i<=a3;i++)
        {
            printf("47");
        }
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
    }
    else if (a4>a3)
    {
        fours=a1-a4;
        sevens=a2-a4;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("74");

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-2;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }
    else if (a3==a4)
    {
        fours=a1-a3-1;
        sevens=a2-a3;

        if (sevens<0)
        {
            printf("-1\n");
            return 0;
        }
        if (fours<0)
        {
            fours=a1-a3;
            sevens=a2-a3-1;

            if (fours<0 || sevens<0)
            {
                printf("-1\n");
                return 0;
            }

            printf("74");
            for (i=1;i<=fours;i++)
            {
                printf("4");
            }

            for (i=1;i<=a4-1;i++)
            {
                printf("74");
            }

            for (i=1;i<=sevens;i++)
            {
                printf("7");
            }
            printf("7");
        }
        else
        {
            printf("4");
            for (i=1;i<=fours;i++)
            {
                printf("4");
            }

            for (i=1;i<=a4-1;i++)
            {
                printf("74");
            }
            printf("7");
            for (i=1;i<=sevens;i++)
            {
                printf("7");
            }
            printf("4");
        }
    }

    printf("\n");

    return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long Int;

int main()
{
    Int a1,a2,a3,a4;
    Int fours,sevens;
    Int i;

    scanf("%I64d %I64d %I64d %I64d",&a1,&a2,&a3,&a4);

    if (a3>a4)
    {
        fours=a1-a3;
        sevens=a4-a2;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }
        for (i=1;i<=a3;i++)
        {
            printf("47");
        }
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
    }
    else if (a4>a3)
    {
        fours=a1-a3;
        sevens=a4-a2;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("74");

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-2;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }
    else if (a3==a4)
    {
        fours=a1-a3-1;
        sevens=a2-a4;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("4");
        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-1;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }

    printf("\n");

    return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
typedef long long Int;

Int ABS(Int a)
{
    if (a<0)
    return a*-1;
    else
    return a;
}

int main()
{
    Int a1,a2,a3,a4;
    Int fours,sevens;
    Int i;

    scanf("%I64d %I64d %I64d %I64d",&a1,&a2,&a3,&a4);

    if ( ABS(a3-a4)>1 )
    {
        printf("-1\n");
        return 0;
    }

    if (a3>a4)
    {
        fours=a1-a3;
        sevens=a2-a3;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }
        for (i=1;i<=a3;i++)
        {
            printf("47");
        }
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
    }
    else if (a4>a3)
    {
        fours=a1-a4;
        sevens=a2-a4;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("74");

        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-2;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }
    else if (a3==a4)
    {
        fours=a1-a3-1;
        sevens=a2-a3;

        if (fours<0 || sevens<0)
        {
            printf("-1\n");
            return 0;
        }

        printf("4");
        for (i=1;i<=fours;i++)
        {
            printf("4");
        }

        for (i=1;i<=a4-1;i++)
        {
            printf("74");
        }
        printf("7");
        for (i=1;i<=sevens;i++)
        {
            printf("7");
        }
        printf("4");
    }

    printf("\n");

    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a1,a2,a3,a4;
int main() {
    cin>>a1>>a2>>a3>>a4;
    if(abs(a3-a4)>1) {cout<<-1<<endl;}
    else {
        string res;
        if(a3==a4) {
            if((a1<a3+1||a2<a3)&&(a1<a3||a2<a3+1)) {cout<<-1<<endl;}
            else if(!(a1<a3+1||a2<a3)){
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2+'4'<<endl;
            }
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3-1;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2<<endl;
            }
        }
        else if(a3>a4) {
            if(a1<a3||a2<a4+1) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4-1;i++) tmp2+='7';
                cout<<tmp1+res+tmp2<<endl;
            }
        }
        else {
            if(a1<a3+1||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2+'4'<<endl;
            }
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a1,a2,a3,a4;
int main() {
    cin>>a1>>a2>>a3>>a4;
    if(abs(a3-a4)>1) {cout<<-1<<endl;}
    else {
        string res;
        if(a3==a4) {
            if((a1<a3+1||a2<a3)&&(a1<a3||a2<a3+1)) {cout<<-1<<endl;}
            else if(a1<a3||a2<a3+1){
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2+'4'<<endl;
            }
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3-1;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2<<endl;
            }
        }
        else if(a3>a4) {
            if(a1<a3||a2<a4+1) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4-1;i++) tmp2+='7';
                cout<<tmp1+res+tmp2<<endl;
            }
        }
        else {
            if(a1<a3+1||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2+'4'<<endl;
            }
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a1,a2,a3,a4;
int main() {
    cin>>a1>>a2>>a3>>a4;
    if(abs(a3-a4)>1) {cout<<-1<<endl;}
    else {
        string res;
        if(a3==a4) {
            if(a1<a3+1||a2<a3) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2+'4'<<endl;
            }
        }
        else if(a3>a4) {
            if(a1<a3||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2<<endl;
            }
        }
        else {
            if(a1<a3+1||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2+'4'<<endl;
            }
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a1,a2,a3,a4;
int main() {
    cin>>a1>>a2>>a3>>a4;
    if(abs(a3-a4)>1) {cout<<-1<<endl;}
    else {
        string res;
        if(a3==a4) {
            if(a1<a3+1||a2<a3) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2+'4'<<endl;
            }
        }
        else if(a3>a4) {
            if(a1<a3||a2<a4+1) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4-1;i++) tmp2+='7';
                cout<<tmp1+res+tmp2<<endl;
            }
        }
        else {
            if(a1<a3+1||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2+'4'<<endl;
            }
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int a1,a2,a3,a4;
int main() {
    cin>>a1>>a2>>a3>>a4;
    if(abs(a3-a4)>1) {cout<<-1<<endl;}
    else {
        string res;
        if(a3==a4) {
            if(a1<a3+1||a2<a3) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3-1;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2+'4'<<endl;
            }
        }
        else if(a3>a4) {
            if(a1<a3||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a3;i++) tmp2+='7';
                cout<<tmp1+res+tmp2<<endl;
            }
        }
        else {
            if(a1<a3||a2<a4) {cout<<-1<<endl;}
            else {
                for(int i=0;i<a3;i++) res+="47";
                string tmp1;
                for(int i=0;i<a1-a3;i++) tmp1+='4';
                string tmp2;
                for(int i=0;i<a2-a4;i++) tmp2+='7';
                cout<<'7'+tmp1+res+tmp2+'4'<<endl;
            }
        }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<deque>
using namespace std;
string ans="";
int main(){
  int u4=0,u7=0;
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(c-d)>1){
    printf("-1\n"); return 0;
  }
  if(c>d) for(int i=0;i<c;i++)u4++,u7++,ans+="47";
  if(c==d) {
    for(int i=0;i<c;i++)u4++,u7++,ans+="47";
    ans+="4";
    u4++;
  }
  if(d>c) for(int i=0;i<d;i++)u4++,u7++,ans+="74";
  int n4=a-u4,n7=b-u7;
  if(n7<0||u7<0){
    printf("-1\n");
    return 0;
  }
  string a4="",a7="";
  for(int i=0;i<n4;i++)a4+="4";
  for(int i=0;i<n7;i++)a7+="7";
  bool found4=0,found7=0;
  for(int i=0;i<ans.length();i++){
    if(!found4&&ans[i]=='4'){
      cout<<a4;
      found4=1;
    }
    if(!found7&&ans[i]=='7'){
      cout<<a7;
      found7=1;
    }
    cout<<ans[i];
  }
  cout<<"\n";
  return 0;
}