#K63042. Counting Rectangles

    ID: 31665 Type: Default 1000ms 256MiB

Counting Rectangles

Counting Rectangles

In this problem, you are given the dimensions of a rectangle: n (number of rows) and m (number of columns). You need to determine the total number of distinct sub-rectangles (of any size) that can be formed within the n x m rectangle. The number of rectangles can be computed using the formula:

[ \text{Total Rectangles} = \left(\frac{n(n+1)}{2}\right) \times \left(\frac{m(m+1)}{2}\right) ]

This computation is based on the observation that each rectangle is defined by choosing two distinct horizontal boundaries and two distinct vertical boundaries. Solve the problem by reading input from standard input and outputting the result to standard output.

inputFormat

The input consists of two integers n and m separated by a space, where 1 ≤ n, m ≤ 10^5. These represent the number of rows and columns of the rectangle.

outputFormat

Output a single integer — the total number of distinct sub-rectangles that can be formed within the given rectangle.## sample

1 1
1

</p>