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;
bool vis[504][5004];
int d, s;
struct Ds {
  int D, S;
  vector<char> num;
};
Ds make_Ds(int a, int b) {
  Ds T;
  T.D = a;
  T.S = b;
  return T;
}
queue<Ds> q;
int w33ha() {
  while (!q.empty()) q.pop();
  memset(vis, 0, sizeof(vis));
  vis[0][s] = 1;
  Ds ppi;
  ppi = make_Ds(0, s);
  ppi.num.clear();
  q.push(ppi);
  while (!q.empty()) {
    Ds x = q.front();
    q.pop();
    if (x.S == 0 && x.D == 0) {
      for (int i = 0; i < x.num.size(); i++) printf("%c", x.num[i]);
      puts("");
      return 0;
    }
    int G;
    for (int i = 0; i <= 9; i++) {
      if (i > x.S) continue;
      G = (x.D * 10 + i) % d;
      if (vis[G][x.S - i]) continue;
      vis[G][x.S - i] = 1;
      Ds now;
      now = make_Ds(G, x.S - i);
      now.num = x.num;
      now.num.push_back((char)i + '0');
      q.push(now);
    }
  }
  puts("-1");
  return 0;
}
int main() {
  while (scanf("%d%d", &d, &s) != EOF) w33ha();
  return 0;
}