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;
int s, d;
struct Number {
  string number;
  int sum;
  int du;
};
bool danhdau[500 + 10][5000 + 10];
string BFS(vector<Number> ds) {
  string ans = "-1";
  set<pair<int, int>> sett;
  queue<Number> q;
  for (auto x : ds) {
    q.push(x);
  }
  while (!q.empty()) {
    Number cur = q.front();
    q.pop();
    for (int i = 0; i <= 9; i++) {
      Number tam;
      tam.sum = cur.sum + i;
      tam.du = (cur.du * 10 + i) % d;
      if (tam.du == 0 && tam.sum == s) {
        tam.number = cur.number + char(i + '0');
        return tam.number;
      }
      if (tam.sum > s) continue;
      if (danhdau[tam.du][tam.sum] == true) continue;
      tam.number = cur.number + char(i + '0');
      q.push(tam);
      danhdau[tam.du][tam.sum] = true;
    }
  }
  return ans;
}
void Solve() {
  cin >> d >> s;
  vector<Number> dsnb;
  for (int i = 1; i <= 9; i++) {
    Number x;
    x.number = char(i + '0');
    x.du = i % d;
    x.sum = i;
    if (x.du == 0 && x.sum == s) {
      cout << x.number;
      return;
    }
    if (x.sum > s) continue;
    if (danhdau[x.du][x.sum] == true) continue;
    if (x.sum <= s) {
      danhdau[x.du][x.sum] = true;
      dsnb.push_back(x);
    }
  }
  cout << BFS(dsnb) << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}