import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    } main {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = Integer.parseInt(sc.nextLine()); num Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int new_num = num; new_num num int hundreds = num / 100; hundreds num / 100 num 100 int tens = ((num / 10) % 10); tens ((num / 10) % 10) (num / 10) num 10 10 int ones = num % 10; ones num % 10 num 10 if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        } tens < hundreds tens hundreds {
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        } new_num = new_num + ((hundreds - tens) * 10) new_num new_num + ((hundreds - tens) * 10) new_num ((hundreds - tens) * 10) (hundreds - tens) hundreds tens 10 if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            } ones > hundreds ones hundreds {
                new_num = new_num - (ones - hundreds);
            } new_num = new_num - (ones - hundreds) new_num new_num - (ones - hundreds) new_num (ones - hundreds) ones hundreds {
                new_num = new_num + (hundreds - ones);
            } new_num = new_num + (hundreds - ones) new_num new_num + (hundreds - ones) new_num (hundreds - ones) hundreds ones if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        } (tens == hundreds) && (ones < hundreds) (tens == hundreds) tens hundreds (ones < hundreds) ones hundreds {
            new_num = new_num + (hundreds - ones);
        } new_num = new_num + (hundreds - ones) new_num new_num + (hundreds - ones) new_num (hundreds - ones) hundreds ones {
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        } new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1) new_num ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1) ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1) ((hundreds + 1) * 100) (hundreds + 1) hundreds 1 100 ((hundreds + 1) * 10) (hundreds + 1) hundreds 1 10 (hundreds + 1) hundreds 1 if((hundreds == tens) && (tens == ones)){
            new_num = num;
        } (hundreds == tens) && (tens == ones) (hundreds == tens) hundreds tens (tens == ones) tens ones {
            new_num = num;
        } new_num = num new_num num System.out.println(String.valueOf(new_num)) System.out.println System.out System System.out String.valueOf(new_num) String.valueOf String new_num String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int num = Integer.parseInt(sc.nextLine());
        int new_num = num;
        int hundreds = num / 100;
        int tens = ((num / 10) % 10);
        int ones = num % 10;
        if(tens < hundreds){
            new_num = new_num + ((hundreds - tens) * 10);
            if(ones > hundreds){
                new_num = new_num - (ones - hundreds);
            }else{
                new_num = new_num + (hundreds - ones);
            }
        }else if((tens == hundreds) && (ones < hundreds)){
            new_num = new_num + (hundreds - ones);
        }else{
            new_num = ((hundreds + 1) * 100) + ((hundreds + 1) * 10) + (hundreds + 1);
        }
        
        if((hundreds == tens) && (tens == ones)){
            new_num = num;
        }
        
        System.out.println(String.valueOf(new_num));

    }
}
