#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n{0};     cin >> n;     bool flag = false;     bool flag1 = false;     long long int i{0}, x{0}, rem{0};     for (i = 1; i <= 1000000; i++) {       if (n >= 4 * i && n <= 7 * i) {         x = 4 * i;         rem = n - x;         if ((rem % 3) != 0) {           x = 0;           rem = 0;         } else if (rem % 3 == 0) {           break;         }       }     }     if (x == 0 && rem == 0) i = 0;     if (x == 0) {       cout <<  -1  << endl;     } else {       long long int div = rem / 3;       for (long long int j = 1; j <= i - div; j++) {         cout <<  4 ;       }       for (long long int i = 1; i <= div; i++) {         cout <<  7 ;       }       cout << endl;     }     return 0;   }   