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;
pair<int, int> dp[555][5555];
queue<pair<int, int> > Q;
int main() {
  scanf("%d%d", &d, &s);
  for (int i = 0; i <= d; i++)
    for (int j = 0; j <= s; j++) dp[i][j] = (pair<int, int>){-1, -1};
  Q.push({0, 0});
  while (!Q.empty()) {
    pair<int, int> T = Q.front();
    Q.pop();
    for (int i = 0; i < 10; i++) {
      int mod = (T.first * 10 + i) % d;
      int sum = T.second + i;
      if (dp[mod][sum] == (pair<int, int>){-1, -1}) {
        dp[mod][sum] = (pair<int, int>){i, T.first};
        Q.push({mod, sum});
      }
    }
  }
  if (dp[0][s] == (pair<int, int>){-1, -1}) {
    printf("-1\n");
    return 0;
  }
  vector<int> ans;
  int mod = 0, sum = s;
  while (!(mod == 0 && sum == 0)) {
    pair<int, int> T = dp[mod][sum];
    ans.push_back(T.first);
    sum -= T.first;
    mod = T.second;
  }
  reverse(ans.begin(), ans.end());
  for (int first : ans) printf("%d", first);
  printf("\n");
  return 0;
}