Codeforces Beta Round 32(Div. 2,Codeforces 格式)
C
跳蚤
Flea
Codeforces
1700
原题
← BD →

跳蚤AI (CI翻译)

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.

众所周知,伯兰的跳蚤只能进行竖直或水平跳跃,并且每次跳跃的长度始终为 $*s*$ 厘米。一只跳蚤来到了一个大小为 $*n* × *m*$ 厘米的方格棋盘中某个格子的中心(每个格子的大小为 $1 × 1$ 厘米)。她可以随意跳跃任意次,也可以多次经过同一个格子。唯一的限制是她不能跳出棋盘。AI (CI翻译)

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

这只跳蚤可以计算出从起始位置 $(*x*, *y*)$ 出发能够到达的格子数。我们将这个数量记为 $*d*_{*x*, *y*}$。你的任务是求出具有最大可能 $*d*_{*x*, *y*}$ 值的起始位置 $(*x*, *y*)$ 的数量。AI (CI翻译)

Input

输入格式

AI (CI翻译)

The first line contains three integers $*n*$, $*m*$, $*s*$ ($1 ≤ *n*, *m*, *s* ≤ 10^{6}$) — length of the board, width of the board and length of the flea's jump.

第一行包含三个整数 $*n*$、$*m*$、$*s*$($1 ≤ *n*, *m*, *s* ≤ 10^{6}$),分别表示棋盘的长度、宽度以及跳蚤每次跳跃的长度。AI (CI翻译)

Output

输出格式

AI (CI翻译)

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

输出一个整数,即满足要求的跳蚤起始位置的数量。AI (CI翻译)

样例

Input #1
2 3 1000000
Output #1
6
InputCopy OutputCopy
Input #2
3 3 2
Output #2
4
InputCopy OutputCopy
题目信息
题号
32C
时间限制
2 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。