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;
int last1[510][5010], last2[510][5100], pre[510][5100];
int main() {
  int s, d;
  cin >> s >> d;
  memset(last1, -1, sizeof(last1));
  memset(last2, -1, sizeof(last2));
  memset(pre, -1, sizeof(pre));
  queue<pair<int, int> > q;
  q.push(make_pair(0, 0));
  while (!q.empty()) {
    pair<int, int> cur = q.front();
    q.pop();
    for (int i = 0; i < 10; i++) {
      if (i == 0 && cur.first == 0 && cur.second == 0) continue;
      int nx1 = (cur.first * 10 + i) % s, nx2 = cur.second + i;
      if (nx2 > d) continue;
      if (pre[nx1][nx2] != -1) continue;
      last1[nx1][nx2] = cur.first, last2[nx1][nx2] = cur.second;
      pre[nx1][nx2] = i;
      q.push(make_pair(nx1, nx2));
    }
  }
  if (pre[0][d] == -1) {
    cout << -1;
    return 0;
  }
  vector<int> ans;
  int nx1 = 0, nx2 = d;
  while (1) {
    if (pre[nx1][nx2] == -1) break;
    ans.push_back(pre[nx1][nx2]);
    int tmp1 = last1[nx1][nx2];
    int tmp2 = last2[nx1][nx2];
    nx1 = tmp1, nx2 = tmp2;
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i];
  }
  return 0;
}