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;
bool poate[5020][510];
pair<int, int> from[5020][510];
int last[5020][510];
queue<pair<int, int>> de_calc;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int d, s;
  cin >> d >> s;
  for (int i = 1; i <= 9; i++) {
    poate[i][i % d] = 1;
    from[i][i % d] = {-1, -1};
    last[i][i % d] = i;
    de_calc.push({i, i % d});
  }
  bool found = 0;
  while (!de_calc.empty() && !found) {
    int i = de_calc.front().first, j = de_calc.front().second;
    de_calc.pop();
    if (i > s) continue;
    for (int cif = 0; cif <= 9; cif++) {
      int j2 = (10 * j + cif) % d, i2 = i + cif;
      if (poate[i2][j2]) continue;
      poate[i2][j2] = 1;
      from[i2][j2] = {i, j};
      last[i2][j2] = cif;
      de_calc.push({i2, j2});
      if (i2 == s && j2 == 0) {
        found = 1;
        break;
      }
    }
  }
  if (!poate[s][0]) {
    cout << "-1\n";
    return 0;
  }
  string ans = "";
  for (int i = s, j = 0;;) {
    ans += last[i][j] + '0';
    if (from[i][j].first == -1) break;
    int j2 = from[i][j].second;
    i = from[i][j].first;
    j = j2;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << '\n';
  return 0;
}