WOBURN CHALLENGE 1996

Different Bases Multiplication

INPUT FILE: mult.in
OUTPUT FILE: mult.out

In normal everyday usage numbers are thought of in base ten. The reason for this is naturally due to humans having ten fingers on which to perform mathematical operations such as add, subtract and multiply. However, in computer technology, the use of low and high voltage states lends itself to thinking of operations defined on having only these two states. Hence, the binary system as a descriptive tool in computers in quite useful. Moreover, we could easily have a use for other number systems (cartoon characters couting in base 8, some alien species counting in base 97).

Your task is to take two different-base numbers, calculate their product, and return the answer in another base.

For example, "Find 128 + 359 in base 10."

INPUT
The input file contains 5 data sets.
The first line of each data set is the first number and its base.
The second line of each data set is the second number and its base.
The third line of each data set is the base in which the product is to be reported.
All bases will be integers from 2 to 10 inclusive.

OUTPUT
Give the product of the numbers in the specified base.
Each product will be less than or equal to 2 billion (base ten).

Sample Input File

12 8
35 9
10
121 7
121 7
7

(and 3 more inputs)

Output for Sample Input

320
14641
Downloader failed! Response object 006~ASP 0159~Buffering Off~Buffering must be on.