I know that now it is defined as integral of langrangian but historically it was defined like that, moreover, it was an attempt to generalize Fermat's principle of least time to all physical phenomena signifying that nature obeys optimization, but for such purposes why did Pierre Louis Maupertuis chose such a definition, I think the distance stuff is pretty clear, but the speed and mass doesn't seem to make sense, furthermore I am a first year undergrad student, therefore, pardon me for the mistakes and please answer, instead badging it as a stupid question or simply say, you don't know it or never thought about it