import std.stdio;
import std.algorithm;
import std.conv;
import std.numeric;
import std.math;
import std.string;

void main()
{
	auto n = to!int(chomp(readln()));

	int result;
	while (true)
	{
		auto a1 = n / 100;
		auto a2 = (n / 10) % 10;
		auto a3 = n % 10;
	
		if (a1 == a2 && a1 == a3)
		{
			result = n;
			break;
		}
		++n;
	}

	writeln(result);
	stdout.flush();
}