#K2731. Total Training Distance

    ID: 24802 Type: Default 1000ms 256MiB

Total Training Distance

Total Training Distance

Lena follows a unique training schedule. On odd-numbered days, she runs a distance of odd_distance kilometers, and on even-numbered days, she runs even_distance kilometers. Given the total number of training days d, compute the total distance she will run during her training period.

You can compute the total distance using the formula:

\(\text{Total Distance} = \lceil \frac{d}{2} \rceil \times \text{odd\_distance} + \lfloor \frac{d}{2} \rfloor \times \text{even\_distance}\)

where \(\lceil \cdot \rceil\) denotes the ceiling function and \(\lfloor \cdot \rfloor\) denotes the floor function.

inputFormat

The input consists of three space-separated integers:

  • d: the total number of training days
  • odd_distance: the distance (in kilometers) run on odd-numbered days
  • even_distance: the distance (in kilometers) run on even-numbered days

outputFormat

Output a single integer representing the total distance run after d days.

## sample
1 3 4
3