#B3894. Aya’s Spring Outing
Aya’s Spring Outing
Aya’s Spring Outing
Aya's school has organized a spring outing to Binjiang Forest Park. Since the journey is long, the bus will travel on both highways and ground roads.
The bus, which is contracted by the school, travels at a constant speed of $a$ km/h on the highway for $b$ hours, and at a constant speed of $c$ km/h on the ground for $d$ hours.
Your task is to answer the following questions:
- What is the total distance from the school to the park?
- What is the average speed of the bus over the entire journey?
The formulas you may use are:
Total Distance: $$a\times b + c\times d$$
Average Speed: $$\frac{a\times b + c\times d}{b+d}$$
inputFormat
The input consists of four numbers separated by whitespace:
- $a$: the speed on the highway in km/h
- $b$: the time spent on the highway in hours
- $c$: the speed on the ground in km/h
- $d$: the time spent on the ground in hours
It is guaranteed that $b+d>0$.
outputFormat
Output two values separated by a space:
- Total distance from the school to Binjiang Forest Park (in km)
- Average speed of the bus over the entire journey (in km/h)
For average speed, if it is not an integer, print it up to 6 decimal places.
sample
60 2 40 3
240 48