This page is still under construction.

Parts of this page are still being built. What you see may change.

Rectangles 2

Time limit2sMemory limit512 MB

Summary
Count axis-aligned rectangles with vertices on grid points of an n x m grid whose perimeter is at least p.
Level

Medium5 of 10

Topics
Math, Combinatorics, Prefix sum, Implementation
Solved
No attempts yet

Problem

In the 3×23 \times 2 grid shown above, the rectangles whose vertices all lie on grid points and whose sides are vertical or horizontal are: six 1×11 \times 1, four 2×12 \times 1, three 1×21 \times 2, two 2×22 \times 2, two 3×13 \times 1, and one 3×23 \times 2, for a total of 18. A grid point is the intersection of a vertical line and a horizontal line.

You are given a grid of size n×mn \times m. Count how many rectangles have all four vertices on grid points, have vertical or horizontal sides, and have perimeter at least pp. A rectangle of size w×hw \times h has perimeter 2(w+h)2(w + h).

Input

The first and only line of standard input contains three integers nn, mm, and pp separated by spaces (1≤n,m≤50001 \le n, m \le 5000, 4≤p≤2(n+m)4 \le p \le 2(n + m)). Here nn and mm are the dimensions of the grid, and pp is the lower bound on the rectangle perimeter.

Output

On the first line of standard output, print a single integer: the number of rectangles in the n×mn \times m grid whose vertices lie on grid points, whose sides are vertical or horizontal, and whose perimeter is at least pp.

Examples2

  1. Example 1

    Input
    3 2 4
    
    Expected output
    18
    
  2. Example 2

    Input
    3 2 6
    
    Expected output
    12