#C4823. Sum of Large Decimals

    ID: 48404 Type: Default 1000ms 256MiB

Sum of Large Decimals

Sum of Large Decimals

You are given two large decimal numbers represented as strings. These numbers may be very large and may use scientific notation. Your task is to compute the sum of these two numbers. In other words, given two numbers (a) and (b) (where (a, b \in \mathbb{R})), you need to calculate (a+b) and output the result as a string. Make sure that if the result has no fractional part but the inputs indicate decimals (for example, the sum of 0.1234 and 0.8766), you still output a decimal point (i.e. "1.0").

Examples:

  • Input: 1234.56789 and 9876.54321 → Output: 11111.1111
  • Input: -12345.6789 and 12345.6789 → Output: 0.0

Use the formula: $$ result = a + b $$

inputFormat

The input consists of two lines. Each line contains a string that represents a decimal number. The number may be in normal or scientific notation.

outputFormat

Output a single line containing the sum of the two decimal numbers as a string. Ensure that if the sum is a whole number but the input decimals require a decimal point, you output a trailing .0.## sample

1234.56789
9876.54321
11111.1111