Upon his passing, the millionaire left the following will for his children:
My dear children! I invested a fortune in your university education, and I hope it was worthwhile. I have divided my entire inheritance into 2 unequal parts. The smaller portion has been given to our lawyer to distribute equally among you. This amount should enable each of you to start your own business. The larger portion of the inheritance is secured in a bank vault with a password. The first one among you to determine the vault number and the password will inherit this money.
Below are two non-negative integers and . The password and the vault number are, respectively, the largest and smallest numbers for which the sum of the digits equals , and the product of the digits equals . Good luck!
The first line contains two non-negative integers and , A \leq 10^5, B \leq 10^{15}.
The first line should contain the vault number, and the second line should contain the password. If either value does not exist, output instead.
Example 1