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 maxn = 4e6 + 7;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int d, s;
pair<int, int> dp[maxn];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> d >> s;
  for (int i = 0; i <= (d + 1) * (s + 1); i++) dp[i] = make_pair(-1, 0);
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int now = q.front();
    int sum = now / d, r = now % d;
    q.pop();
    for (int i = 0; i < 10; i++) {
      if (sum + i <= s && (dp[(sum + i) * d + (r * 10 + i) % d].first == -1)) {
        dp[(sum + i) * d + (r * 10 + i) % d] = make_pair(now, i);
        q.push((sum + i) * d + (r * 10 + i) % d);
      }
    }
  }
  int now = s * d;
  if (dp[now].first == -1)
    return cout << -1 << '\n', 0;
  else {
    vector<int> v;
    while (now) {
      v.push_back(dp[now].second);
      now = dp[now].first;
    }
    reverse((v).begin(), (v).end());
    for (int i : v) cout << i;
    cout << '\n';
  }
}