2018-10-07 AtCoder Beginner Contest 111 AtCoder Beginner Contest 111 #B n = int(input()) if(n % 111 == 0): print(n) else: print(111 * (1 + n // 111))