#C7245. Counting Rectangles in a Grid

    ID: 51095 Type: Default 1000ms 256MiB

Counting Rectangles in a Grid

Counting Rectangles in a Grid

This problem asks you to calculate the number of rectangles that can be formed in an N x M grid. A rectangle is determined by choosing two distinct horizontal lines and two distinct vertical lines from the grid lines. In a grid with N rows and M columns, there are N+1 horizontal lines and M+1 vertical lines. The total number of rectangles can be computed using the formula:

\( \binom{N+1}{2} \times \binom{M+1}{2} = \frac{N(N+1)}{2} \times \frac{M(M+1)}{2} \)

Implement a program that reads two integers N and M from the standard input and outputs the total number of rectangles that can be formed.

inputFormat

The input consists of a single line containing two space-separated integers N and M, representing the number of rows and columns of the grid, respectively.

outputFormat

Output a single integer, the total number of rectangles that can be formed in the grid.

## sample
2 3
18