P1548 [NOIP 1997 Junior] Chessboard Problem
Background
NOIP 1997 Junior, Problem 1.
Description
Given a chessboard with an $N \times M$ grid $(1≤N≤100,1≤M≤100)$, find how many squares and how many rectangles (excluding squares) it contains.
For example, when $N=2, M=3$:

The number of squares is $8$: there are $6$ squares of side length $1$ and $2$ squares of side length $2$.
The number of rectangles is $10$:
Specifically:
- There are $4$ rectangles of size $2 \times 1$:

- There are $3$ rectangles of size $1 \times 2$:

- There are $2$ rectangles of size $3 \times 1$:

- There is $1$ rectangle of size $3 \times 2$:

Input Format
One line with two integers $N,M$.
Output Format
One line with two integers, the number of squares and the number of rectangles.
Explanation/Hint
Translated by ChatGPT 5