import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    }
}
 import java.util.*; util.* java public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int top = n/100; top n/100 n 100 int ans = 0; ans 0 if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        } n-top*100>top*10+top n-top*100 n top*100 top 100 top*10+top top*10 top 10 top {
            ans = (top+1)*100+(top+1)*10+(top+1);
        } ans = (top+1)*100+(top+1)*10+(top+1) ans (top+1)*100+(top+1)*10+(top+1) (top+1)*100+(top+1)*10+(top+1) (top+1)*100 (top+1) top 1 100 (top+1)*10 (top+1) top 1 10 (top+1) top 1 {
            ans = top*100+top*10+top;
        } ans = top*100+top*10+top ans top*100+top*10+top top*100+top*10+top top*100 top 100 top*10 top 10 top System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int top = n/100;
        int ans = 0;
        if(n-top*100>top*10+top){
            ans = (top+1)*100+(top+1)*10+(top+1);
        }else{
            ans = top*100+top*10+top;
        }
        System.out.println(ans);
    }
}

