Problem 4. Determine the sum of the perimeters of all different rectangles that can be formed from nine squares with a side length of $1 \mathrm{~cm}$ (when constructing the rectangles, not all squares need to be used).
Solution. Let $a$ and $b$ be the lengths of the sides of the corresponding rectangle. If $a=1$, then $b \in\{1,2,3,4,5,6,7,8,9\}$. If $a=2$, then $b \in\{2,3,4\}$. If $a=3$, then $b=3$. Now, the desired sum is equal to

$$
\begin{aligned}
A= & 2(1+1)+2(1+2)+2(1+3)+2(1+4)+2(1+5)+2(1+6) \\
& +2(1+7)+2(1+8)+2(1+9)+2(2+2)+2(2+3)+2(2+4)+2(3+3) \\
= & 156
\end{aligned}
$$