N=int(input()) M=(10**9+N)//N*N while M%10<9:M+=N s="12" N*=10 while s!="".join(reversed(s)):M+=N;s=str(M)[:-1] print(M)