use *' to have arbitrarily big ints.
total grains count.
memoize grain calculation.