# Task
Imagine `n` horizontal lines and `m` vertical lines.

Some of these lines intersect, creating rectangles.

How many rectangles are there?

# Examples

For `n=2, m=2,` the result should be `1`.

there is only one 1x1 rectangle.

For `n=2, m=3`, the result should be `3`.

there are two 1x1 rectangles and one 1x2 rectangle. So `2 + 1 = 3`.

For n=3, m=3, the result should be `9`.

there are four 1x1 rectangles, two 1x2 rectangles, two 2x1 rectangles and one 2x2 rectangle. So `4 + 2 + 2 + 1 = 9`.



# Input & Output


- `[input]` integer `n`

Number of horizontal lines.

Constraints: `0 <= n <= 100`


- `[input]` integer `m`

Number of vertical lines.

Constraints: `0 <= m <= 100`


- `[output]` an integer

Number of rectangles.

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def rectangles(n, m):
	

Solutions:
def rectangles(n, m):
	return m * n * (m - 1) * (n - 1) / 4


rectangles = lambda n, m: n * ~-n * m * ~-m // 4


def rectangles(n, m):
	result = 0
	if n < 2 or m < 2:
		return result
	for i in range(n):
		for j in range(m):
			result += i * j
	return result


from math import factorial

def rectangles(n, m):
	return 0 if n <= 1 or m <= 1 else round(factorial(n) / factorial(n - 2) / 2 * factorial(m) / factorial(m - 2) / 2)


def rectangles(n, m):
	OneOnOneRects = (n - 1) * (m - 1)
	sumOfM = sum(range(1, m - 1))
	sumOfN = sum(range(1, n - 1))
	OneAndSome = (n - 1) * sumOfM
	SomeAndOne = (m - 1) * sumOfN
	SomeAndSome = 0
	for i in range(2, n):
		for j in range(2, m):
			SomeAndSome = SomeAndSome + (n - i) * (m - j)
	return OneOnOneRects + OneAndSome + SomeAndOne + SomeAndSome


import scipy.special as math

def rectangles(n, m):
	return int(math.comb(n, 2) * math.comb(m, 2))