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 maxN = 500 * 5000 + 5;
const int maxD = 505, maxS = 5005;
bool v[maxD][maxS];
pair<int, int> pre[maxD][maxS];
bool bfs(int d, int s) {
  queue<pair<int, int> > q;
  q.push({0, 0});
  v[0][0] = 1;
  while (!q.empty()) {
    auto u = q.front();
    if (u.first == s && u.second == 0) return true;
    q.pop();
    for (int i = int(0); i < int(10); i++) {
      int res = (u.second * 10 + i) % d;
      int suma = u.first + i;
      if (!v[res][suma] && suma <= s) {
        v[res][suma] = true;
        pre[res][suma] = u;
        q.push({suma, res});
      }
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cin.tie(0), cout.tie(0),
      cout.precision(15);
  int s, d;
  cin >> d >> s;
  if (bfs(d, s)) {
    int sum = s;
    int res = 0;
    vector<int> arr;
    while (sum) {
      arr.push_back(sum - pre[res][sum].first);
      int tmp = pre[res][sum].second;
      sum = pre[res][sum].first;
      res = tmp;
    }
    reverse(arr.begin(), arr.end());
    for (int i = int(0); i < int((int)arr.size()); i++) {
      cout << arr[i];
    }
  } else {
    cout << -1;
  }
  return 0;
}