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;
struct node {
  int x;
  int y;
  string ans;
};
queue<node> q;
bool v[505][5005];
int main() {
  int n, m;
  cin >> n >> m;
  string x;
  for (int i = 0; i < 10; i++) {
    q.push((node){i % n, i, x + (char)('0' + i)});
    v[i % n][i] = 1;
  }
  while (!q.empty()) {
    node temp = q.front();
    if (temp.x == 0 && temp.y == m) {
      cout << temp.ans;
      return 0;
    }
    q.pop();
    for (int j = 0; j <= 9; j++) {
      int nx = (temp.x * 10 + j) % n;
      int ny = temp.y + j;
      if (ny > m) continue;
      if (v[nx][ny] == 1) {
        continue;
      }
      q.push((node){nx, ny, temp.ans + (char)('0' + j)});
      v[nx][ny] = 1;
    }
  }
  cout << -1;
  return 0;
}