Fomin D.

The hostess baked a pie for the guests. At the table, there can be either $p$ people or $q$ people ($p$ and $q$ are coprime). Into what minimum number of pieces (not necessarily equal) should the pie be cut in advance so that in any case it can be distributed equally?