406646: GYM102471 A City

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Citytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Hi ICPCer, welcome to Xi'an.

Being a beautiful ancient city, Xi'an is the capital city of Zhou, Qin, Han, and Tang Dynasties. With a long history, the streets in Xi'an have a grid pattern.

Attracted by the streets' structure, Coach Pang would like to conduct his research on them. He draws an $$$n\times m$$$ grid on the board. The grid consists $$$n+1$$$ vertical line segments and $$$m+1$$$ horizontal line segments. The vertical and horizontal line segments intersect at exactly $$$(n+1)\times(m+1)$$$ points, forming $$$n\times m$$$ unit squares. We call the $$$(n+1)\times (m+1)$$$ intersections grid points. Output the number of line segments(not only vertical or horizontal) $$$l$$$ satisfying the following three conditions:

  1. The length is not zero.
  2. Both endpoints of $$$l$$$ are grid points.
  3. The midpoint of $$$l$$$ is a grid point.
Input

The only line contains two integers $$$n, m$$$($$$1\le n, m\le 1000$$$).

Output

Print the answer in a single line.

ExamplesInput
1 1
Output
0
Input
2 3
Output
14

加入题单

上一题 下一题 算法标签: