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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        ans = i;
        break;
      }
    } int i = n; int i = n; i n i <= 999 i 999 i++ i++ i {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        ans = i;
        break;
      }
    } {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        ans = i;
        break;
      }
    } String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        ans = i;
        break;
      } (s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2)) (s.charAt(0) == s.charAt(1)) s.charAt(0) s.charAt s 0 s.charAt(1) s.charAt s 1 (s.charAt(1) == s.charAt(2)) s.charAt(1) s.charAt s 1 s.charAt(2) s.charAt s 2 {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        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++) {
      String s = String.valueOf(i);
      if((s.charAt(0) == s.charAt(1)) && (s.charAt(1) == s.charAt(2))) {
        ans = i;
        break;
      }
    }
    System.out.println(ans);
  }
}
