Adding Continued Fractions
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Two finite continued fractions are provided.
Your task is to determine a finite continued fraction whose value equals the sum of the values of the given fractions.
Input
The first line of the input specifies the first fraction in the format [a_0, a_1, ..., a_{n−1}] where (1 n 100), (-100 a_0 100), and (1 a_i 100) for (i > 0). The second line provides the second fraction in the same format.
Output
Output a single line containing the continued fraction that represents the sum of the given fractions, formatted in the same way.
Examples
Input #1
Answer #1
Submissions 40
Acceptance rate 5%