eolymp
bolt
Try our new interface for solving problems
Problems

High-Precision Number

High-Precision Number

A number with \textbf{30} decimal digits of precision can be represented by a structure type as shown in the examples below. It includes a \textbf{30}-element integer array (digits), a single integer (decpt) to represent the position of the decimal point and an integer (or character) to represent the sign (+/-). For example, the value \textbf{-218.302869584} might be stored as \includegraphics{https://static.e-olymp.com/content/42/42dc405de3359bb6f0e488dfb86e039d46c445e9.jpg} The value \textbf{0.0000123456789} might be represented as follows. \includegraphics{https://static.e-olymp.com/content/30/303f6807fdf11078e2febc07b67747627aba3f13.jpg} Your task is to write a program to calculate the sum of high-precision numbers. \InputFile The first line contains a positive integer \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{100}) indicating the number of groups of high-precision numbers (maximum \textbf{30} significant digits). Each group includes high-precision numbers (one number in a line) and a line with only \textbf{0} indicating the end of each group. A group can contain \textbf{100} numbers at most. \OutputFile For each group, print out the sum of high-precision numbers (one value in a line). All zeros after the decimal point located behind the last non-zero digit must be discarded.
Time limit 1 second
Memory limit 64 MiB
Input example #1
4
4.12345678900000000005
-0.00000000012
0
-1300.1
1300.123456789
0.0000000012345678912345
0
1500.61345975
-202.004285
-8.60917475
0
-218.302869584
200.0000123456789
0
Output example #1
4.12345678888000000005
0.0234567902345678912345
1290
-18.3028572383211
Source ACM-ICPC Thailand National Programming Contest 2010, Prince of Songkla University Phuket Campus 24 August 2010