A positive integer a is given. Baron Munchausen claims that he knows such a positive integer n that if one multiplies n by a, the sum of its digits decreases a times. In other words, S(an) = S(n)/a, where S(x) denotes the sum of digits of the number x. 

Find out if what Baron told can be true.

Input

The only line contains a single integer a (2 ≤ a ≤ 10^3).

Output

If there is no such number n, print -1.

Otherwise print any appropriate positive integer n. Your number must not consist of more than 5⋅10^5 digits. We can show that under given constraints either there is no answer, or there is an answer no longer than 5⋅10^5 digits.

Examples

Input


2


Output


6


Input


3


Output


6669


Input


10


Output


-1
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3;
const int M = N + 7;
const double EPS = 1e-10;
const int MOD = 1e9 + 7;
const long long INF = 1e18 + 17;
bool visited[M][M + M];
pair<int, pair<int, int> > par[M][M + M];
void solve() {
  int a;
  cin >> a;
  queue<pair<int, int> > q;
  q.push({0, N});
  cerr << "start\n";
  while (!q.empty()) {
    int carry = q.front().first;
    int balance = q.front().second;
    q.pop();
    for (int d = 0; d < 10; d++) {
      if (!carry && balance == N && !d) continue;
      int nxtCarry = (carry + d * a) / 10;
      int nxtBalance = (balance + a * ((carry + d * a) % 10) - d);
      if (abs(nxtBalance - N) <= a && !visited[nxtCarry][nxtBalance]) {
        visited[nxtCarry][nxtBalance] = true;
        q.push({nxtCarry, nxtBalance});
        par[nxtCarry][nxtBalance] = {d, {carry, balance}};
        if (!nxtCarry && !nxtBalance) break;
      }
    }
  }
  cerr << "end\n";
  if (!visited[0][N]) {
    cout << "-1\n";
    return;
  }
  string ans;
  int carry = 0;
  int balance = N;
  do {
    int digit = par[carry][balance].first;
    pair<int, int> from = par[carry][balance].second;
    if (digit || ans != "") ans += digit + '0';
    carry = from.first;
    balance = from.second;
  } while (carry || balance != N);
  cout << ans << "\n";
}
int main() {
  int tt = 1;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (tt--) {
    solve();
  }
  return 0;
}
