On the response of beams to an arbitrary number of concentrated moving masses