There's an equation that says work = force * distance * cos (theta)
Theta being the angle between the surface and the object.
So, since the direction is the same as that of the force, you can say that theta is equal to zero.
Cos (0) = 1
So, W = (10) * (4) * (1) = 40 Joules