Preparando MOJI

Flea

2000ms 262144K

Description:

It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n × m centimeters (each cell is 1 × 1 centimeters). She can jump as she wishes for an arbitrary number of times, she can even visit a cell more than once. The only restriction is that she cannot jump out of the board.

The flea can count the amount of cells that she can reach from the starting position (x, y). Let's denote this amount by dx, y. Your task is to find the number of such starting positions (x, y), which have the maximum possible value of dx, y.

Input:

The first line contains three integers n, m, s (1 ≤ n, m, s ≤ 106) — length of the board, width of the board and length of the flea's jump.

Output:

Output the only integer — the number of the required starting positions of the flea.

Sample Input:

2 3 1000000

Sample Output:

6

Sample Input:

3 3 2

Sample Output:

4

Informação

Codeforces

Provedor Codeforces

Código CF32C

Tags

math

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 08:27:42

Relacionados

Nada ainda