Problem: You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

Input

The first line contains two positive integers d and s (1 ≤ d ≤ 500, 1 ≤ s ≤ 5000) separated by space.

Output

Print the required number or -1 if it doesn't exist.

Examples

Input

13 50


Output

699998


Input

61 2


Output

1000000000000000000000000000001


Input

15 50


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const int D = 505, N = 5005;
using namespace std;
int d, s;
bool vis[D][N];
pair<int, int> par[D][N];
int main() {
  cin >> d >> s;
  deque<pair<int, int>> dq;
  for (int i = 1; i < 10; i++) {
    dq.push_back({i % d, i});
    vis[i % d][i] = 1;
  }
  while (!dq.empty()) {
    pair<int, int> P = dq.front();
    dq.pop_front();
    int u = P.first, v = P.second;
    if (u == 0 && v == s) {
      break;
    }
    for (int i = 0; i < 10; i++) {
      int nu = (10 * u + i) % d, nv = v + i;
      if (nv > s) continue;
      if (vis[nu][nv]) continue;
      vis[nu][nv] = 1;
      par[nu][nv] = {u, v};
      dq.push_back({nu, nv});
    }
  }
  if (vis[0][s]) {
    pair<int, int> cur = {0, s};
    string ans;
    while (cur.first != 0 || cur.second != 0) {
      pair<int, int> pr = par[cur.first][cur.second];
      ans += (-pr.second + cur.second) + '0';
      cur = pr;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << '\n';
  } else {
    cout << -1 << endl;
  }
  return 0;
}