Yes, you can. Average speed is concerned with the total distance covered, irrespective of the path’s linearity.