how to calculate rest values - Search