#K39547. Minimum Total Medal Cost

    ID: 26444 Type: Default 1000ms 256MiB

Minimum Total Medal Cost

Minimum Total Medal Cost

You are given the number of participants n and the cost of three types of medals: gold, silver, and bronze (denoted by a, b, and c respectively). The task is to compute the minimum total cost required to purchase one medal of each type for each participant. The formula for the total cost is given by:

\(\text{TotalCost} = n \times (a + b + c)\)

Input: A single line containing four space-separated integers representing n, a, b, and c.

Output: A single integer representing the minimum total cost.

Make sure your solution reads input from standard input (stdin) and outputs the result to standard output (stdout).

inputFormat

The input consists of one line with four integers separated by spaces: n a b c. Here:

  • n represents the number of participants.
  • a represents the cost of a gold medal.
  • b represents the cost of a silver medal.
  • c represents the cost of a bronze medal.

All input values are non-negative integers.

outputFormat

Output a single integer which is the computed minimum total cost of purchasing the medals.

## sample
4 3 1 2
24