#K75387. Sum of Strings

    ID: 34408 Type: Default 1000ms 256MiB

Sum of Strings

Sum of Strings

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

The input is provided via standard input (stdin) where the first line contains the integer \( n \) representing the number of elements, and the second line contains \( n \) space-separated non-negative integers (each as a string). Your program should output the sum to standard output (stdout).

Mathematically, if the list of numbers is \( a_1, a_2, \dots, a_n \), you need to compute:

\( S = \sum_{i=1}^{n} a_i \)

and print \( S \) as a string.

inputFormat

The input consists of two lines:

  • The first line contains an integer \( n \) denoting the number of non-negative integers.
  • The second line contains \( n \) space-separated non-negative integers represented as strings.

outputFormat

Output a single line containing the sum of the given non-negative integers as a string.## sample

3
1 2 3
6