import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

          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 a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

          System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

          System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

          System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int n = 0; n 0 int ans = 0; ans 0 do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans); a > ans a ans {
          n++;
          ans = n*100 + n*10 + n;
        } n++ n ans = n*100 + n*10 + n ans n*100 + n*10 + n n*100 + n*10 + n n*100 n 100 n*10 n 10 n 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 a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

          System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      
        int a = sc.nextInt();
        int n = 0;
        int ans = 0;
      
        do {
          n++;
          ans = n*100 + n*10 + n;
        } while(a > ans);

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

          System.out.println(ans);
    }
}