'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = parseInt(args[0][0], 10)
	
	for (let i = 1; i <= 9; i++) {
		if (i * 111 >= n) {
			console.log(i * 111)
			break
		}
	}
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
