#K8646. Calculate Total Time for Journey
Calculate Total Time for Journey
Calculate Total Time for Journey
Four friends are on a journey where each friend walks from the starting point to a destination and then returns. In addition, each friend experiences a fixed extra delay due to crowd navigation. The total time spent by a friend is given by the formula:
where:
- (d) is the distance from the starting point to the destination,
- (s) is the walking speed, and
- (t) is the additional delay time.
Your task is to compute and print the total time for each friend. Each friend’s data is provided on a new line in the input.
inputFormat
The input consists of four lines. Each line contains three space-separated integers representing the distance (d), the speed (s), and the additional delay time (t) for a friend.
outputFormat
Output the total time for each friend on a separate line. The total time is calculated as (\frac{2d}{s} + t) and should be printed as an integer.## sample
500 10 30
300 5 20
700 14 50
200 4 10
130
140
150
110
</p>