#C13877. Add Large Numbers

    ID: 43463 Type: Default 1000ms 256MiB

Add Large Numbers

Add Large Numbers

You are given two non-negative integers represented as strings. Your task is to compute the sum of these two numbers and output the result as a string.

The added challenge is that these numbers can be extremely large, so they cannot be handled using standard integer types without risking overflow. Therefore, you must implement the addition manually (digit by digit) or use methods/libraries supporting arbitrary precision arithmetic.

For example:

  • 123 + 456 = 579
  • 9 + 1 = 10
  • 999 + 1 = 1000

The underlying mathematical model is defined by the formula:

\( S = \sum_{i=0}^{n-1} (a_i + b_i) \times 10^i \)

where \(a_i\) and \(b_i\) are the digits of the first and second number respectively, and the sum is computed from the least significant digit to the most significant digit taking care of the carry.

inputFormat

The input consists of two lines. The first line contains the first large number as a string. The second line contains the second large number as a string. These strings represent non-negative integers and may contain leading zeros.

outputFormat

Output a single line containing the sum of the two numbers as a string.

## sample
123
456
579