#C8263. Taco Challenge Time Calculation

    ID: 52226 Type: Default 1000ms 256MiB

Taco Challenge Time Calculation

Taco Challenge Time Calculation

You are given three integers: m, t, and d. Here:

  • m represents the total number of challenges.
  • t is the time required to solve the first challenge.
  • d is the additional incremental time needed for each subsequent challenge.

Your task is to compute the total time required to solve all m challenges. The time taken for each challenge increases linearly. The total time can be computed using the formula:

$$total = m \times t + d \times \frac{(m-1) \times m}{2}$$

For example, if m = 5, t = 3, and d = 2, then the total time is 35.

inputFormat

The input is provided via standard input (stdin) and consists of three space-separated integers:

  • m: The number of challenges.
  • t: The time required to complete the first challenge.
  • d: The incremental time for each subsequent challenge.

It is guaranteed that these values are non-negative integers.

outputFormat

Output a single integer to standard output (stdout), representing the total time required to solve all the challenges.

The result is calculated using the formula:

$$total = m \times t + d \times \frac{(m-1) \times m}{2}$$

## sample
5 3 2
35