DRY up math a little