New Kitchen Pavement

Time limit: 0.1s Memory limit: 256MB Input: Output:

James has decided to tile the floor of his kitchen with square tiles. His kitchen can be represented by a rectangle of dimensions H×WH \times W, while the square tiles have side length SS.

He starts by placing a tile in the lower left corner of the kitchen and then places other tiles next to it, keeping the edges aligned.

The result James wants on a 5 x 7 floor with tiles of side length 3.\text{The result James wants on a 5 x 7 floor with tiles of side length 3}.

If a tile does not fit entirely in the room, he can cut it and reuse the cut piece for another edge.
Since the tiles have a very complex but symmetrical decorative pattern, cut tiles can be used with the constraint that the cut sides must only be in contact with the upper perimeter or the right perimeter of the room. There must be uncut sides of the tiles on the lower and left perimeters of the room. It is possible to rotate the tiles.

Task

At least how many tiles are necessary to pave the kitchen?

Input data

The input file consists of a line containing integers HH, WW, SS.

Output data

The output file must contain a single line consisting of integer TT, the minimal number of necessary tiles.

Constraints and clarifications

  • 1H10 0001 \le H \le 10 \ 000.
  • 1W10 0001 \le W \le 10 \ 000.
  • 1S10 0001 \le S \le 10 \ 000.
# Score Constraints
1 0 Examples
2 10 S=1S = 1
3 20 H=1H = 1
4 30 H,W100H, W \leq 100
5 40 No additional restrictions

Example 1

stdin

5 7 3

stdout

4

Explanation

The first sample case corresponds to the one illustrated in the text. The tile scraps used for the top edge are used for the side edge and the corner.

Example 2

stdin

4 4 3

stdout

3

Explanation

In second sample case we want to obtain the following result:

To do this, James uses three tiles: one whole tile at the bottom left, one that is divided between the right side and the top edge, and one for the top right corner.

He couldn't use the remaining part of the second tile for the corner, otherwise he would have had cut edges adjacent to other tiles, as well as to the perimeter, which is against the rules for tiling.

Log in or sign up to be able to send submissions!