Calculating work with friction