import java.util.*;

public class Main {
	public static void main(String[] args) {
      Scanner sc =new Scanner(System.in);
      int N = sc.nextInt();
      int ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      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 ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      System.out.println(ans);
    }
} Main public static void main(String[] args) {
      Scanner sc =new Scanner(System.in);
      int N = sc.nextInt();
      int ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      System.out.println(ans);
    } main {
      Scanner sc =new Scanner(System.in);
      int N = sc.nextInt();
      int ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      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 ans =0; ans 0 for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      } int i=N; int i=N; i N i<=999 i 999 i++ i++ i {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      } {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      } int i3 = i % 10; i3 i % 10 i 10 int i2 = (i % 100 - i3) /10; i2 (i % 100 - i3) /10 (i % 100 - i3) i % 100 i 100 i3 10 int i1 = (i - i2 * 10 - i3) / 100; i1 (i - i2 * 10 - i3) / 100 (i - i2 * 10 - i3) i - i2 * 10 - i3 i i2 * 10 i2 10 i3 100 if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        } i3 == i2 && i2 == i1 i3 == i2 i3 i2 i2 == i1 i2 i1 {
          ans = i;
          break;
        } ans = i ans i break; 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 ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      System.out.println(ans);
    }
} public class Main {
	public static void main(String[] args) {
      Scanner sc =new Scanner(System.in);
      int N = sc.nextInt();
      int ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      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 ans =0;
      for (int i=N; i<=999; i++) {
        int i3 = i % 10;
        int i2 = (i % 100 - i3) /10;
        int i1 = (i - i2 * 10 - i3) / 100;
        if (i3 == i2 && i2 == i1) {
          ans = i;
          break;
        }
      }
      System.out.println(ans);
    }
}