import std.stdio, std.range, std.conv, std.string, std.array, std.functional;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;
import std.container.binaryheap;

void main()
{
    auto N = readln().strip.to!(long);
    foreach(n; N..1000)
    {
        if(n%10 == n/10%10 && n%10 == n/100%10)
        {
            writeln(n);
            return;
        }
    }
}