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;
void solve() {
  int d, ss;
  cin >> d >> ss;
  vector<vector<pair<pair<int, int>, int> > > rem(
      max(d + 1, 10),
      vector<pair<pair<int, int>, int> >(ss + 1, {{-1, -1}, -1}));
  queue<int> q;
  for (int i = 1; i <= min(ss, 9); i++) {
    q.push(i % d);
    q.push(i);
    pair<pair<int, int>, int> t = {{-1, -1}, i + '0'};
    rem[i % d][i] = t;
  }
  while (!q.empty()) {
    int r = q.front();
    q.pop();
    int s = q.front();
    q.pop();
    for (int i = 0; i < 10; i++) {
      int rn = (r * 10 + i) % d;
      int sn = (s + i);
      if (sn > ss) break;
      if (rem[rn][sn].second != -1) continue;
      pair<pair<int, int>, int> t = {{r, s}, i + '0'};
      rem[rn][sn] = t;
      q.push(rn);
      q.push(sn);
    }
  }
  if (rem[0][ss].second == -1) {
    cout << "-1\n";
    return;
  }
  string t;
  t.push_back(rem[0][ss].second);
  int r = rem[0][ss].first.first, s = rem[0][ss].first.second;
  while (r != -1 && s != -1) {
    t.push_back(rem[r][s].second);
    pair<int, int> a = rem[r][s].first;
    r = a.first;
    s = a.second;
  }
  reverse(t.begin(), t.end());
  cout << t << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}