#include <bits/stdc++.h>   using namespace std;   int main() {     int sum;     cin >> sum;     int a, b, c = -1;     for (int i = 0; i * 7 <= sum; i++) {       if ((sum - i * 7) % 4 == 0) {         int j = (sum - i * 7) / 4;         if (c == -1 || i + j < c) {           c = i + j;           a = j;           b = i;         }       }     }     if (c == -1)       cout << -1;     else {       for (int i = 0; i < a; i++) cout <<  4 ;       for (int j = 0; j < b; j++) cout <<  7 ;       cout <<   n ;     }     return 0;   }   