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 sz = 1e5 + 4;
const int oo = 1e9 + 4;
const int mod = 1e9 + 7;
int dp[5004][504];
pair<int, int> p[5004][504];
int s, d;
void foa() {
  for (int i = 0; i < 5004; i++)
    for (int j = 0; j < 504; j++) dp[i][j] = oo;
}
void bfs() {
  foa();
  queue<pair<int, int> > q;
  for (int i = 1; i < 10; i++)
    if (dp[i][i % d] == oo) {
      dp[i][i % d] = 1;
      p[i][i % d].first = -1;
      q.push({i, i % d});
    }
  while (!q.empty()) {
    int i = q.front().first, j = q.front().second;
    q.pop();
    for (int k = 0; k < 10; k++) {
      int ni = i + k, nj = (j * 10 + k) % d;
      if (dp[ni][nj] == oo) {
        dp[ni][nj] = dp[i][j] + 1;
        p[ni][nj] = {i, j};
        if (ni < 5004) q.push({ni, nj});
      }
    }
  }
}
void print(int i, int j) {
  int li = p[i][j].first, lj = p[i][j].second, k = i - li;
  if (li != -1)
    print(li, lj);
  else
    k--;
  cout << k;
}
void solve() {
  cin >> d >> s;
  bfs();
  if (dp[s][0] == oo)
    cout << -1;
  else
    print(s, 0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}