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 d, s;
bool vis[505][5005];
struct node {
  int mod, sum;
};
struct sta {
  int n;
  int x, y;
} st[505][5005];
void bfs() {
  queue<node> q;
  node a;
  a.mod = 0, a.sum = 0;
  q.push(a);
  vis[0][0] = true;
  while (!q.empty()) {
    node tmp = q.front();
    q.pop();
    for (int i = 0; i < 10; i++) {
      if (tmp.sum + i <= s) {
        node temp;
        temp.sum = tmp.sum + i;
        temp.mod = ((tmp.mod * 10) % d + i) % d;
        if (!vis[temp.mod][temp.sum]) {
          vis[temp.mod][temp.sum] = true;
          st[temp.mod][temp.sum].n = i;
          st[temp.mod][temp.sum].x = tmp.mod,
          st[temp.mod][temp.sum].y = tmp.sum;
          q.push(temp);
        }
        if (temp.mod == 0 && temp.sum == s) {
          vis[0][s] = true;
          return;
        }
      }
    }
  }
}
void print(int d, int s) {
  if (d == 0 && s == 0) return;
  print(st[d][s].x, st[d][s].y);
  printf("%d", st[d][s].n);
}
int main() {
  scanf("%d%d", &d, &s);
  bfs();
  if (!vis[0][s])
    printf("-1\n");
  else {
    print(0, s);
    printf("\n");
  }
  return 0;
}