#P11136. Magical Compressed Towel

    ID: 13197 Type: Default 1000ms 256MiB

Magical Compressed Towel

Magical Compressed Towel

This problem involves a magical compressed towel that can expand infinitely. Initially, the towel has dimensions a, b, and h centimeters long, wide, and high respectively. Every time the towel encounters water (exactly k times), its length, width, and height each increase by 1 centimeter. Your task is to compute the final volume of the towel in cubic centimeters after these water encounters.

Formally, the final dimensions will be \(a+k\), \(b+k\), and \(h+k\). Therefore, the final volume is given by:

[ \text{Volume} = (a+k) \times (b+k) \times (h+k) ]

Someone considered this problem too easy and passed it on to you. Solve it accordingly!

inputFormat

The input consists of a single line containing four space-separated integers:

  • a – the initial length of the towel (in centimeters)
  • b – the initial width of the towel (in centimeters)
  • h – the initial height of the towel (in centimeters)
  • k – the number of times the towel encounters water

Each time the towel meets water, its length, width, and height each increase by 1 cm.

outputFormat

Output a single integer representing the volume of the towel in cubic centimeters after k water encounters.

sample

1 2 3 4
210