#include <bits/stdc++.h>
using namespace std;
long long M;
long long mul(long long a, long long b) { return ((a % M) * (b % M)) % M; };
long long sub(long long a, long long b) { return ((a % M) - (b % M) + M) % M; };
long long pwr(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (a == 1) return 1;
  long long p1 = pwr(a, b / 2), p2 = mul(p1, p1);
  if (b % 2) return mul(p2, a);
  return p2;
};
long long add(long long a, long long b) { return (a % M + b % M) % M; };
long long divi(long long a, long long b) {
  if (a < b) return 0LL;
  return mul(a, pwr(b, M - 2));
};
vector<int> s(1000005, 0), d(1000005, 0);
void fn() {
  s[1] = -1;
  s[2] = -1;
  s[3] = -1;
  s[4] = 0;
  d[4] = 1;
  s[5] = -1;
  s[6] = -1;
  s[7] = 1;
  for (int i = 8; i <= 1000000; i++) {
    if (s[i - 7] == -1 && s[i - 4] == -1)
      s[i] = -1;
    else if (s[i - 7] == -1) {
      s[i] = s[i - 4];
      d[i] = d[i - 4] + 1;
    } else if (s[i - 4] == -1) {
      if (i == 10) cout << "heyi\n";
      s[i] = s[i - 7] + 1;
      d[i] = d[i - 7];
    } else {
      if (s[i - 4] + d[i - 4] <= s[i - 7] + d[i - 7])
        s[i] = s[i - 4], d[i] = 1 + d[i - 4];
      else
        s[i] = 1 + s[i - 7], d[i] = d[i - 7];
    }
  }
}
int main() {
  int n;
  cin >> n;
  fn();
  int ct1 = s[n];
  if (ct1 == -1)
    cout << -1;
  else {
    int ct2 = d[n];
    for (int i = 0; i < ct2; i++) cout << 4;
    for (int i = 0; i < ct1; i++) cout << 7;
  }
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Petya wonders eagerly what minimum lucky number has the sum of digits equal to n. Help him cope with the task.

Input

The single line contains an integer n (1 ≤ n ≤ 106) — the sum of digits of the required lucky number.

Output

Print on the single line the result — the minimum lucky number, whose sum of digits equals n. If such number does not exist, print -1.

Examples

Input

11


Output

47


Input

10


Output

-1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long M;
long long mul(long long a, long long b) { return ((a % M) * (b % M)) % M; };
long long sub(long long a, long long b) { return ((a % M) - (b % M) + M) % M; };
long long pwr(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (a == 1) return 1;
  long long p1 = pwr(a, b / 2), p2 = mul(p1, p1);
  if (b % 2) return mul(p2, a);
  return p2;
};
long long add(long long a, long long b) { return (a % M + b % M) % M; };
long long divi(long long a, long long b) {
  if (a < b) return 0LL;
  return mul(a, pwr(b, M - 2));
};
vector<int> s(1000005, 0), d(1000005, 0);
void fn() {
  s[1] = -1;
  s[2] = -1;
  s[3] = -1;
  s[4] = 0;
  d[4] = 1;
  s[5] = -1;
  s[6] = -1;
  s[7] = 1;
  for (int i = 8; i <= 1000000; i++) {
    if (s[i - 7] == -1 && s[i - 4] == -1)
      s[i] = -1;
    else if (s[i - 7] == -1) {
      s[i] = s[i - 4];
      d[i] = d[i - 4] + 1;
    } else if (s[i - 4] == -1) {
      if (i == 10) cout << "heyi\n";
      s[i] = s[i - 7] + 1;
      d[i] = d[i - 7];
    } else {
      if (s[i - 4] + d[i - 4] <= s[i - 7] + d[i - 7])
        s[i] = s[i - 4], d[i] = 1 + d[i - 4];
      else
        s[i] = 1 + s[i - 7], d[i] = d[i - 7];
    }
  }
}
int main() {
  int n;
  cin >> n;
  fn();
  int ct1 = s[n];
  if (ct1 == -1)
    cout << -1;
  else {
    int ct2 = d[n];
    for (int i = 0; i < ct2; i++) cout << 4;
    for (int i = 0; i < ct1; i++) cout << 7;
  }
  return 0;
}

```