QOJ.ac

QOJ

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

#5300. Rectangles 2

統計

How many rectangles can you find in the figure below?

problem_10659_1.gif

We have found: 6 rectangles 1 × 1, 4 rectangles 2 × 1, 3 rectangles 1 × 2, 2 rectangles 2 × 2, 2 rectangles 3 × 1 and one rectangle 3 × 2, what gives 18 in total. Clearly, we are interested in rectangles with vertices in grid points, i.e., the points located at the intersections of vertical and horizontal line segments, and having vertical or horizontal sides. The above grid has dimensions 3 × 2.

And how many such rectangles of perimeter at least 6 can be found in the figure? You can find the answer in the Example section.

Input Format

The first and only line of the standard input contains three integers: $n$, $m$ and $p$ (1$ ≤ n, m ≤ 5\,000$, $4 ≤ p ≤ 2(n+m)$), representing the dimensions of the grid and the lower bound for the perimeter of the rectangles.

Output Format

In the first line of the standard output your program should output one integer: the number of rectangles with vertices in grid points of the grid $n × m$, having vertical or horizontal sides and which perimeter is at least $p$.

Example

Input

3 2 4

Output

18

Input 2

3 2 6

Output 2

12

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.