727B.md (2160B)
1 Source: https://codeforces.com/problemset/problem/727/B 2 3 B. Bill Total Value 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 Vasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which the names of the purchases and their prices are printed in a row without any spaces. Check has the format "*name*1*price*1*name*2*price*2...*name**n**price**n*", where *name**i* (name of the *i*-th purchase) is a non-empty string of length not more than 10, consisting of lowercase English letters, and *price**i* (the price of the *i*-th purchase) is a non-empty string, consisting of digits and dots (decimal points). It is possible that purchases with equal names have different prices. 22 23 The price of each purchase is written in the following format. If the price is an integer number of dollars then cents are not written. 24 25 Otherwise, after the number of dollars a dot (decimal point) is written followed by cents in a two-digit format (if number of cents is between 1 and 9 inclusively, there is a leading zero). 26 27 Also, every three digits (from less significant to the most) in dollars are separated by dot (decimal point). No extra leading zeroes are allowed. The price always starts with a digit and ends with a digit. 28 29 For example: 30 31 * "234", "1.544", "149.431.10", "0.99" and "123.05" are valid prices, 32 * ".333", "3.33.11", "12.00", ".33", "0.1234" and "1.2" are not valid. 33 34 Write a program that will find the total price of all purchases in the given bill. 35 36 Input 37 38 The only line of the input contains a non-empty string *s* with length not greater than 1000 — the content of the bill. 39 40 It is guaranteed that the bill meets the format described above. It is guaranteed that each price in the bill is not less than one cent and not greater than 106 dollars. 41 42 Output 43 44 Print the total price exactly in the same format as prices given in the input. 45 46 Examples 47 48 Input 49 50 ``` 51 chipsy48.32televizor12.390 52 ``` 53 54 Output 55 56 ``` 57 12.438.32 58 ``` 59 60 Input 61 62 ``` 63 a1b2c3.38 64 ``` 65 66 Output 67 68 ``` 69 6.38 70 ``` 71 72 Input 73 74 ``` 75 aa0.01t0.03 76 ``` 77 78 Output 79 80 ``` 81 0.04 82 ```