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 M = 5005;
const int N = 505;
int d, s;
struct Node {
  int x, y;
  vector<int> co;
};
bool vis[N][M];
int pre[N][M][3];
queue<Node> q;
bool bfs() {
  vis[0][0] = 1;
  Node t;
  t.x = t.y = 0;
  t.co.clear();
  q.push(t);
  while (!q.empty()) {
    t = q.front(), q.pop();
    for (int i = 0; i <= 9; i++) {
      int xx = (10 * t.x + i) % d, yy = t.y + i;
      if (vis[xx][yy] || yy > s) continue;
      vis[xx][yy] = 1;
      Node p;
      p = t;
      p.x = xx, p.y = yy;
      p.co.push_back(i);
      if (xx == 0 && yy == s) {
        for (int j = 0; j < p.co.size(); j++) printf("%d", p.co[j]);
        putchar('\n');
        return true;
      }
      q.push(p);
    }
  }
  return false;
}
int main() {
  cin >> d >> s;
  if (bfs() == 0) printf("-1\n");
  return 0;
}