For all positive integers x, let f(x)=⎩⎨⎧110xx+1if x=1if x is divisible by 10otherwise and define a sequence as follows: x1=x and xn+1=f(xn) for all positive integers n. Let d(x) be the smallest n such that xn=1. (For example, d(100)=3 and d(87)=7.) Let m be the number of positive integers x such that d(x)=20. Find the sum of the distinct prime factors of m.