6019: Flea

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:2 通过:2

题目描述

众所周知,伯兰的跳蚤只能垂直和水平跳跃,跳跃的长度总是等于s厘米。一只跳蚤发现自己处于 n×m 厘米大小的格子板某个牢房的中心(每个牢房为 1×1 厘米)。她可以随心所欲地跳跃任意次数,甚至可以不止一次访问牢房。唯一的限制是她不能跳出棋盘。
跳蚤可以计算她可以从起始位置(xy)到达的细胞数量。让我们用dx,y.您的任务是找到此类起始位置 (xy 的数量,其最大可能值为dx,y.

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.
Examples
Input
2 3 1000000
Output
6
Input
3 3 2
Output
4

输入格式

第一行包含三个整数 nms (1≤n,m,s≤106 − 板的长度、板的宽度和跳蚤跳跃的长度。

输出格式

输出唯一的整数 - 跳蚤所需的起始位置的数量。
Input

2 3 1000000
Output
6
Input
3 3 2
Output
4

输入样例 复制

3 3 2

输出样例 复制

4