N = input() k = len(N) n = int(N) kk = 10 ** k # print(kk) while(1): if((kk-1) % n == 0) : break; k += 1; kk *= 10; print(k)