import std.stdio,std.regex;

void main(){
	auto next = readln().chomp().to!size_t;

	auto list = [111,222,333,444,555,666,777,888,999];
	foreach( val; list ){
		if( next <= val ){
			writeln(val);
			break;
		}
		continue;
	}

	return;
}

import std.string,std.conv;