Calculating work done by friction