avoid division by zero if some variables are 0