G-matrix elements with effective masses for mesons and nucleons