UVa 355 - The Bases Are Loaded

Summary
This is very similar to question UVa 389. Given the base of the number and the base to convert as well a number find its converted value. If the number is not a valid base number print is an illegal base x number where x is the base you are converting from.

Explanation
Look at the page for UVa 389. Convert the number of the base b if it is a base b number to base a.

Gotchas

 * The numbers being tested are likely > 2^31 use unsigned int or long long

Input
2 10 10101 5 3 126 15 11 A4C 16 16 7FFFFFFFFFF 2 3 0

Output
10101 base 2 = 21 base 10 126 is an illegal base 5 number A4C base 15 = 1821 base 11 7FFFFFFFFFF base 16 = 7FFFFFFFFFF base 16 0 base 2 = 0 base 3