#include <bits/stdc++.h>
using namespace std;
int dp[102][902][2];
void print_ans(int m, int s, int flag) {
  if (m == 0) return;
  cout << dp[m][s][flag];
  if (dp[m][s][flag] != -1) print_ans(m - 1, s - dp[m][s][flag], flag);
  return;
}
int main() {
  int m, s;
  cin >> m >> s;
  if (s == 0) {
    cout << (m == 1 ? "0 0" : "-1 -1");
    return 0;
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j][0] = -1;
      dp[i][j][1] = -1;
    }
  }
  for (int i = 0; i < 10; i++) {
    dp[1][i][0] = i;
    dp[1][i][1] = i;
  }
  for (int i = 2; i <= m; i++) {
    for (int j = 0; j <= s; j++) {
      int flag = -1;
      int f = -1;
      for (int k = 0; k <= 9; k++) {
        if (i == m && k == 0) continue;
        if (j >= k && flag == -1 && dp[i - 1][j - k][0] != -1) flag = k;
      }
      for (int k = 9; k >= 0; k--) {
        if (i == m && k == 0) continue;
        if (j >= k && f == -1 && dp[i - 1][j - k][1] != -1) f = k;
      }
      dp[i][j][0] = flag;
      dp[i][j][1] = f;
    }
  }
  if (m != 0) {
    print_ans(m, s, 0);
    cout << " ";
    print_ans(m, s, 1);
  } else
    cout << "-1 -1";
  cout << endl;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.

Input

The single line of the input contains a pair of integers m, s (1 ≤ m ≤ 100, 0 ≤ s ≤ 900) — the length and the sum of the digits of the required numbers.

Output

In the output print the pair of the required non-negative integer numbers — first the minimum possible number, then — the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes).

Examples

Input

2 15


Output

69 96


Input

3 0


Output

-1 -1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int dp[102][902][2];
void print_ans(int m, int s, int flag) {
  if (m == 0) return;
  cout << dp[m][s][flag];
  if (dp[m][s][flag] != -1) print_ans(m - 1, s - dp[m][s][flag], flag);
  return;
}
int main() {
  int m, s;
  cin >> m >> s;
  if (s == 0) {
    cout << (m == 1 ? "0 0" : "-1 -1");
    return 0;
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j][0] = -1;
      dp[i][j][1] = -1;
    }
  }
  for (int i = 0; i < 10; i++) {
    dp[1][i][0] = i;
    dp[1][i][1] = i;
  }
  for (int i = 2; i <= m; i++) {
    for (int j = 0; j <= s; j++) {
      int flag = -1;
      int f = -1;
      for (int k = 0; k <= 9; k++) {
        if (i == m && k == 0) continue;
        if (j >= k && flag == -1 && dp[i - 1][j - k][0] != -1) flag = k;
      }
      for (int k = 9; k >= 0; k--) {
        if (i == m && k == 0) continue;
        if (j >= k && f == -1 && dp[i - 1][j - k][1] != -1) f = k;
      }
      dp[i][j][0] = flag;
      dp[i][j][1] = f;
    }
  }
  if (m != 0) {
    print_ans(m, s, 0);
    cout << " ";
    print_ans(m, s, 1);
  } else
    cout << "-1 -1";
  cout << endl;
}

```