- calculate r and ** 99 only if required
- calculate ** 99 using multiplications instead of pow