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 TEN = 10;
const int D = 500 + 1;
const int S = 5000 + 1;
bool used[S][D];
int digit[S][D], prev_x[S][D], prev_y[S][D];
int main() {
  int d, s;
  cin >> d >> s;
  used[0][0] = true;
  queue<pair<int, int>> q;
  q.push({0, 0});
  while (!q.empty()) {
    auto pos = q.front();
    q.pop();
    int x = pos.first, y = pos.second;
    for (int dig = 0; dig < TEN; dig++) {
      int xx = x + dig, yy = ((y * 10 + dig) % d);
      if (xx < S && !used[xx][yy]) {
        used[xx][yy] = 1;
        digit[xx][yy] = dig;
        prev_x[xx][yy] = x;
        prev_y[xx][yy] = y;
        q.push({xx, yy});
      }
    }
  }
  if (!used[s][0]) {
    cout << -1 << endl;
    return 0;
  }
  string ans;
  int x = s, y = 0;
  while (x > 0 || y > 0) {
    ans += (char)('0' + digit[x][y]);
    int xx = prev_x[x][y];
    int yy = prev_y[x][y];
    x = xx, y = yy;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}