Add digits and bases problem