Problem

Source: Tournament of Towns oral round p3

Tags: rectangle, combinatorics, combinatorial geometry, geometry, Tournament of Towns



Rectangle $p*q,$ where $p,q$ are relatively coprime positive integers with $p <q$ is divided into squares $1*1$.Diagonal which goes from lowest left vertice to highest right cuts triangles from some squares.Find sum of perimeters of all such triangles.