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>
using namespace std;
const int MAXD = 500, MAXS = 5000;
int D[MAXD][MAXS + 1], P[MAXD][MAXS + 1], R[MAXD][MAXS + 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int d = 0; d < MAXD; ++d)
    for (int s = 0; s <= MAXS; ++s) D[d][s] = -1;
  int d, s;
  cin >> d >> s;
  D[0][0] = 0;
  queue<pair<int, int> > Q;
  Q.emplace(0, 0);
  while (!Q.empty()) {
    pair<int, int> p = Q.front();
    Q.pop();
    int r = p.first, t = p.second;
    for (int k = 0; k < 10; ++k) {
      int rr = (10 * r + k) % d, tt = t + k;
      if (tt > s) continue;
      if (D[rr][tt] == -1) {
        D[rr][tt] = D[r][t] + 1;
        P[rr][tt] = k;
        R[rr][tt] = r;
        Q.emplace(rr, tt);
      }
    }
  }
  if (D[0][s] == -1) {
    cout << -1 << '\n';
    return 0;
  }
  string S;
  int r = 0;
  while (s != 0) {
    int k = P[r][s];
    S.push_back('0' + k);
    r = R[r][s];
    s -= k;
  }
  reverse(S.begin(), S.end());
  cout << S << '\n';
  return 0;
}