Problem Statement | |||||||||||||
A square is divided into N * M equal rectangles. For example, here's a square divided into 2 * 3 rectangles: +--+--+--+ |**|**|**| |**|**|**| |**|**|**| +--+--+--+ |**|**|**| |**|**|**| |**|**|**| +--+--+--+ Find the number of squares made up by these rectangles, i.e., all vertices of squares must coincide with one of the rectangles' vertices. You should count only squares with non-zero area. Two squares are equal if and only if they share the exact same set of vertices. Only count squares whose sides are parallel to the sides of the original square. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | N and M will each be between 1 and 100000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|