best and worst calculation done