Rounding necessary with BigDecimal numbers
Try to use roudingMode of setScale method.
Some thing like:
BigDecimal aa = a.setScale(i+j, BigDecimal.ROUND_HALF_DOWN);
You have two BigDecimal numbers both of which require over a 1000 decimal places. Trying to set the scale to only have 113 decimal places means you will lose precision and therefore you need to round.
You can use the setScale methods that take a RoundingMode to prevent the exception but not the rounding.