IMO 1984 LL NET41

Determine positive integers p, q, and r such that the diagonal

IMO 1984 LL NET41

Origin: NET

Problem

Determine positive integers p, q, and r such that the diagonal of a block consisting of p\timesq \timesr unit cubes passes through exactly 1984 of the unit cubes, while its length is minimal. (The diagonal is said to pass through a unit cube if it has more than one point in common with the unit cube.)