Update fomular for computing mid index