avoid calculating a0 function twice