#C2486. Minimum Fence Segments

    ID: 45807 Type: Default 1000ms 256MiB

Minimum Fence Segments

Minimum Fence Segments

You are given the dimensions of a rectangular flower bed along with the length of a single fence segment. Your task is to determine the minimum number of fence segments required to cover the entire perimeter of the flower bed. The perimeter of the flower bed is computed as (2\times(w + h)), where (w) is the width and (h) is the height. Since each fence segment has a fixed length (b), if the perimeter does not divide evenly by (b), an extra segment is needed to cover the remaining part. This relation can be computed using the ceiling function as follows:

[ \text{segments} = \left\lceil \frac{2(w + h)}{b} \right\rceil ]

For example, if (w=5), (h=3), and (b=2), then the perimeter is (16) and the minimum number of segments is (8).

inputFormat

Input is provided on a single line from standard input (stdin) containing three space-separated integers: (w), (h), and (b), representing the width, height of the flower bed and the length of each fence segment respectively.

outputFormat

Output a single integer to standard output (stdout) which is the minimum number of fence segments required to cover the perimeter of the flower bed.## sample

5 3 2
8