digits are from 2 to 8, so the index should be digits - 1