Effective Bertini theorem and formulas for multiplicity and the local Łojasiewicz exponent