import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
          
      for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      }

	}
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
          
      for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      }

	}
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
          
      for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      }

	} main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
          
      for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      }

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      } int i=111; int i=111; i 111 i<=999 i 999 i=i+111 i=i+111 i i+111 i 111 {
        if(i>=N){System.out.print(i);break;}
      } {
        if(i>=N){System.out.print(i);break;}
      } if(i>=N){System.out.print(i);break;} i>=N i N {System.out.print(i);break;} System.out.print(i) System.out.print System.out System System.out i break; String[] args args
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
          
      for(int i=111;i<=999;i=i+111){
        if(i>=N){System.out.print(i);break;}
      }

	}
}