add number algorithm