import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    } main {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter("") sc.useDelimiter sc "" int x = 111; x 111 int d3 = sc.nextInt(); d3 sc.nextInt() sc.nextInt sc int d2 = sc.nextInt(); d2 sc.nextInt() sc.nextInt sc int d1 = sc.nextInt(); d1 sc.nextInt() sc.nextInt sc if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        } d3<d2 d3 d2 {
            x = (d3+1)*111;
        } x = (d3+1)*111 x (d3+1)*111 (d3+1) d3 1 111 if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        } d3>d2 d3 d2 {
            x = d3*111;
        } x = d3*111 x d3*111 d3 111 {
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        } if(d1<=d2) x=d3*111;
            else x= (d3+1)*111; d1<=d2 d1 d2 x=d3*111 x d3*111 d3 111 x= (d3+1)*111 x (d3+1)*111 (d3+1) d3 1 111 System.out.println(x) System.out.println System.out System System.out x String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
        int x = 111;
        int d3 = sc.nextInt();
        int d2 = sc.nextInt();
        int d1 = sc.nextInt();
        if(d3<d2){
            x = (d3+1)*111;
        }else if(d3>d2){
            x = d3*111;
        }else{
            if(d1<=d2) x=d3*111;
            else x= (d3+1)*111;
        }
        System.out.println(x);
    }
}