A cylinder containing an ideal gas is in vertical position and has a piston of mass M that is able to move up or down without friction.