A digital river is the sequence of number where the number following is n+ the sum of its digits for example 12345=12345+15=12360
If the first number of digital rivers is k we call the river k for example river 480 is the sequence { 480,492,507,519...} and river 483 is the sequence {483,493,519........}normal streams and river can meet and the same is true for a digital rivers share the same value. For example river 480 meets river 483 at 519 meets river 507 at 507 and never meet river 481
Every digital river will eventually meet river 1, river 3, or river 9
Write a program which inputs a single integer n (1<=n<=16384) and outputs the value where river n meets one of the above three rivers