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 dp[500][5001];
pair<pair<int, int>, int> pr[500][5001];
int d, s;
int main() {
  cin >> d >> s;
  dp[0][0] = true;
  pr[0][0] = make_pair(make_pair(-1, -1), -1);
  queue<pair<int, int> > P;
  P.push(make_pair(0, 0));
  while (!P.empty()) {
    int i = P.front().first, j = P.front().second;
    P.pop();
    for (int k = 0; k < 10; k++) {
      int ni = (i * 10 + k) % d;
      int nj = j + k;
      if (nj > s) continue;
      if (!dp[ni][nj]) {
        dp[ni][nj] = true;
        pr[ni][nj] = make_pair(make_pair(i, j), k);
        P.push(make_pair(ni, nj));
      }
    }
  }
  if (!dp[0][s]) {
    cout << -1 << endl;
    return 0;
  }
  string ans = "";
  int i = 0, j = s;
  while (i || j) {
    ans += pr[i][j].second + '0';
    int ni = pr[i][j].first.first;
    int nj = pr[i][j].first.second;
    i = ni, j = nj;
  }
  for (int i = ans.size(); i--;) cout << ans[i];
  cout << endl;
}