A Fraction Problem

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type

Given two fractions \frac{a}{b} and \frac{c}{d}, find any fraction that is strictly between \frac{a}{b} and \frac{c}{d}.

That is, find any fraction \frac{e}{f} that satisfies:

\displaystyle \frac{a}{b} < \frac{e}{f} < \frac{c}{d}

Input Specification

The first line will contain four integers, a, b, c, d (1 \le a, b, c, d \le 10^9, \frac{a}{b} < \frac{c}{d}).

Output Specification

Output e and f separated by a space. e and f must both be integers.

Sample Input

1 2 2 3

Sample Output

3 5

Note: the sample output is only one possible answer.


There are no comments at the moment.