Averaging out calories to avoid diabetes