function main(arg) {
	arg = Number(arg.split("\n")[0])
	var arr = [111,222,333,444,555,666,777,888,999]

	for (var i = 0; i < arr.length; i++) {
		if (arg <= arr[i]) {
			console.log(arr[i])
			break
		}
	}
	
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));