n = int(input()) ans = 0 now = 1 t = str(now) + str(now) + str(now) while int(t)