High-Precision Number#2625

High-Precision Number

1 секунда
64 мегабајта
Врло лако

A number with 30 decimal digits of precision can be represented in a structure, as shown in the examples below. This structure includes a 30-element array of integers (digits), a single integer (decpt) to indicate the position of the decimal point, and an integer (or character) to represent the sign (+/-).

For example, the value -218.302869584 might be stored as:

The value 0.0000123456789 could be represented as follows:

Your task is to write a program to calculate the sum of high-precision numbers.

Улаз

The first line contains a single integer (1 \leq n \leq 100) — the number of groups of high-precision numbers. Each group consists of several high-precision numbers (each on its own line), and a line containing only 0 that indicates the end of the group. Each high-precision number has at most significant digits. Each group contains at most numbers.

Излаз

For each group, output the sum of the high-precision numbers in the group (one value per line). All insignificant zeros after the decimal point (following the last nonzero digit) must be discarded.

Примери

Пример 1

Loading
Loading