import java.util.*;

public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
} import java.util.*; util.* java public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
} Main static int[] list; list public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    } main {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(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 = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      } int i = n; int i = n; i n i <= 999 i 999 i++ i++ i {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      } {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      } char[] a = String.valueOf(i).toCharArray(); a String.valueOf(i).toCharArray() String.valueOf(i).toCharArray String.valueOf(i) String.valueOf String i if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } a[0] == a[1] &&a[0] == a[2] a[0] == a[1] a[0] a 0 a[1] a 1 a[0] == a[2] a[0] a 0 a[2] a 2 {
          System.out.println(i);
          break;
        } System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
} public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
} Main
import java.util.*;

public class Main {
  static int[] list;
    public static void main(String[] args) throws Exception{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      for (int i = n; i <= 999; i++) {
        char[] a = String.valueOf(i).toCharArray();
        if(a[0] == a[1] &&a[0] == a[2]) {
          System.out.println(i);
          break;
        } 
      }
    }
}