'use strict'

const main = (input) => {
    const num = input.split('\n')[0]
    const nums = num.split('')

    if([...new Set(nums)].length === 1){
        console.log(num)
        return;
    }

    const a = nums.shift()
    const as = a + a + a
    if(num < as){
        console.log(as)
    } else {
        const b = (parseInt(a) + 1).toString()
        const bs = b + b + b
        console.log(bs)
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))