Fractions: n-th term of the sequence
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Arithmetic progression is given with the first term a / b and difference p / q. Find the n-th term of the sequence.
Input
Two fractions a / b, p / q and number n. All numbers are positive integers no more than 10^6
.
Output
Print the n-th term of arithmetic progression in the form of irreducible fraction.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 380
Acceptance rate 36%