SP32949 ADADIGIT - Ada and Digits 2
Description
Ada the Ladybug likes numbers. Her friends know it so they wanted to give her a number as a gift. Sadly, they bought the number in IKEA so Ada has to assemble the number by herself. Now she is in following situation - she has a few digits before herself and she is wondering what number she will create. As she doesn't understand the manual (it is in Swedish) she has possibility to assemble anything.
She is not sure yet, anyway her favourite options are to assemble number with the most divisors or the number with the biggest sum of divisors. Can you help her to find such?
**NOTE:** To assemble number from digits, simply choose any permutation of digits. Leading zeroes are perfectly OK **but** you have to use all the digits.
Input Format
The first line of each test-case will contain an integer **1 , the number of digits to assemble.**
The next line will contain **N** digits **0 .**
Output Format
Output two integers - the number with the most divisors AND the number with biggest sum of divisors. In case there are multiple such numbers, choose the lesser one. As long as you would use leading zeroes, output the number without the leading zeroes.