This page is still under construction.

Parts of this page are still being built. What you see may change.

Comma Sum Multiline

Time limit1sMemory limit256 MB

Summary
Join the input lines into one comma-separated string, split it at commas, and print the sum of the numbers.
Level

Easy1 of 10

Topics
Implementation, String
Solved
No attempts yet

Problem

A string SS that consists only of digits and commas is given over several lines. The line breaks are not part of SS, so joining the given lines in order gives SS itself. Splitting SS at every comma yields a sequence of natural numbers. Compute the sum of those numbers.

Input

The string SS is given over one or more lines. Each line consists only of digits and commas.

The joined string has length at most 10,000. It does not start or end with a comma, and it never contains two commas in a row. Each comma separated number is a natural number between 1 and 1,000,000 with no leading zero.

Output

Print the sum of the natural numbers contained in SS on one line.

Examples4

  1. Example 1

    Input
    10,20,
    3
    0,50
    ,1
    00
    
    Expected output
    210
    
  2. Example 2

    Input
    1
    
    Expected output
    1
    
  3. Example 3

    Input
    2
    
    Expected output
    2
    
  4. Example 4

    Input
    10,20
    30
    
    Expected output
    2040