The force up the incline is constant. The displacement up directed up the slope, so
where is the angle the force makes with the displacement.
For the second (flat) part, note that the force is now parallel to the displacment. Apply the same formula. Then add the two answers.