By Newton's second law, the gravitational force F between an object of mass m and a planet of radius r and mass M is on the surface of the planet is
F = G M m / r ² = m a
where
G = 6.67 × 10⁻¹¹ N•m²/kg², the universal gravitational constant
a = the acceleration of the object (not the planet; note that the right side is m times a, and not M times a)
The object's mass cancels on either side, leaving you with
a = G M / r ²
and this acceleration is due to gravity. On Earth, a = g.
Let M be the mass of Earth and r its radius; then
g (Earth) = G M / r ² ≈ 9.80 m/s²
To find g on Mercury, replace r with 0.38r and M with 0.055M :
g (Mercury) = G (0.055M) / (0.38r )² = 0.055/0.38² G M / r ²
g (Mercury) ≈ 0.38 g (Earth) ≈ 3.73 m/s²