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;
long long int C[505][5005];
pair<long long int, long long int> dp[505][5005];
long long int visited[505][5005] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int d, s;
  cin >> d >> s;
  for (long long int i = 0; i < 505; i++) {
    for (long long int j = 0; j < 5005; j++) {
      dp[i][j] = make_pair(0, 0);
    }
  }
  queue<pair<long long int, long long int> > q;
  q.push(make_pair(0, s));
  long long int md, sum, ten;
  pair<long long int, long long int> dum;
  while (!q.empty()) {
    dum = q.front();
    q.pop();
    md = dum.first;
    sum = dum.second;
    if (md == 0 && sum == 0) {
      break;
    }
    visited[md][sum] = 1;
    for (long long int i = 0; i <= 9 && i <= sum; i++) {
      long long int dd = ((md * 10) % d + i) % d;
      long long int ss = sum - i;
      if (ss < 0) continue;
      if (visited[dd][ss]) continue;
      C[dd][ss] = i;
      dp[dd][ss] = make_pair(md, sum);
      visited[dd][ss] = 1;
      if (dd == 0 && ss == 0) break;
      q.push(make_pair(dd, ss));
    }
  }
  if (!visited[0][0]) {
    cout << -1 << endl;
    return 0;
  }
  vector<long long int> ans;
  md = 0, sum = 0, ten = 1;
  long long int cnt = 0;
  while (!(md == 0 && sum == s)) {
    pair<long long int, long long int> ii = dp[md][sum];
    ans.push_back(C[md][sum]);
    md = ii.first;
    sum = ii.second;
  }
  reverse(ans.begin(), ans.end());
  for (long long int i = 0; i < ans.size(); i++) {
    cout << ans[i];
  }
}