#K52847. Total Fencing Cost
Total Fencing Cost
Total Fencing Cost
Alice wants to fence her rectangular garden. She needs to know how much it will cost to fence the entire perimeter. The garden has a length l and a width w (in meters), and the fencing costs c dollars per meter. The total cost is calculated by computing the perimeter of the rectangle and then multiplying it by the cost per meter.
Mathematically, the perimeter P is given by:
\( P = 2 \times (l + w) \)
and the total fencing cost is:
\( \text{Cost} = P \times c = 2 \times (l + w) \times c \)
inputFormat
The input consists of a single line containing three space-separated integers:
- l (the length of the garden in meters),
- w (the width of the garden in meters), and
- c (the cost per meter of the fencing in dollars).
outputFormat
Output a single integer representing the total cost of fencing the garden in dollars.
## sample10 5 2
60