how to calculate rests - Search