#P6467. Addition or Multiplication of Powers of Ten

    ID: 19681 Type: Default 1000ms 256MiB

Addition or Multiplication of Powers of Ten

Addition or Multiplication of Powers of Ten

Given two integers that are powers of 10 with at most 100 digits, compute the result of their addition or multiplication.

The input consists of an operator and two numbers. The operator is either \( + \) for addition or \( * \) for multiplication. Each number is given in the form of 1 followed by a number of zeros (e.g. \(10^k\)).

For multiplication, note that multiplying two powers of ten is equivalent to adding their exponents. For addition, if the two numbers have the same number of digits \( (10^k + 10^k = 2\times10^k) \), then the result is \(2\) followed by \(k\) zeros. If the numbers have different lengths, let the longer number be \(10^n\) and the shorter be \(10^m\) with \(n > m\). Then the sum is obtained by adding the smaller number at the appropriate position in the longer one, resulting in a digit \(1\) replacing the zero at the \((n-m+1)^{th}\) position from the left.

inputFormat

The first line contains a single character which is either + or * indicating the operation.

The second line contains the first integer, and the third line contains the second integer. Each number is a power of ten represented as a 1 followed by at most 99 zeros.

outputFormat

Output a single line containing the result of the operation.

sample

+
10
100
110