Rectangle Cutting

From CSES. Cut rectangle into squares DP. Solve the geometry problem "Rectangle Cutting".

Examples
Input: [1,2]
Output: 1
Hints

Rectangle Cutting

**From CSES.** Cut rectangle into squares DP. Solve the geometry problem "Rectangle Cutting".