Given an integer num, repeatedly add all its digits until the result has only one digit, and return it.
num