QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#14739. Counting Triangles

Statistics

Given an $n \times m$ grid, calculate the total number of triangles whose vertices are all grid points. The figure below shows a triangle on a $4 \times 4$ grid.

Note that the three vertices of a triangle cannot be collinear.

Input

A single line containing two space-separated positive integers $m$ and $n$.

Output

Output a single positive integer, the number of such triangles.

Constraints

For 30% of the data:

  • $1 \le m, n \le 10$

For 100% of the data:

  • $1 \le m, n \le 1000$

Examples

Input 1

1 1

Output 1

4

Input 2

2 2

Output 2

76

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.