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;
struct vl {
  long long num, vet;
};
const long long INF = 1e18;
const long long MAXN = 5e3 + 69;
const long long MAXD = 569;
long long q = 1, m, n, x, y, z, k, l, d;
long long s;
long long a[MAXN];
vl dp[MAXD][MAXN];
void init() {
  for (long long i = 0; i <= d; i++) {
    for (long long j = 0; j <= s; j++) {
      dp[i][j] = {INF, INF};
    }
  }
}
void bfs() {
  init();
  queue<vl> q;
  for (long long i = 1; i <= 9; i++) {
    dp[i % d][i] = {i, 0};
    q.push({i % d, i});
  }
  while (!q.empty()) {
    vl u = q.front();
    q.pop();
    long long mod = u.num;
    long long sum = u.vet;
    for (long long i = 0; i <= 9; i++) {
      long long newmod = (mod * 10 + i) % d;
      long long newsum = sum + i;
      if (newsum > s) continue;
      if (dp[newmod][newsum].num != INF) continue;
      dp[newmod][newsum].num = i;
      dp[newmod][newsum].vet = mod;
      q.push({newmod, newsum});
    }
  }
  if (dp[0][s].num == INF) {
    cout << -1;
    return;
  }
  vector<long long> ans;
  long long cursum = s;
  long long curmod = 0;
  while (cursum != 0) {
    long long x = dp[curmod][cursum].num;
    long long y = dp[curmod][cursum].vet;
    ans.push_back(x);
    cursum -= x;
    curmod = y;
  }
  reverse(ans.begin(), ans.end());
  for (long long u : ans) cout << u;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (q--) {
    cin >> d >> s;
    init();
    bfs();
  }
}