import java.util.*;

class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int s = N / 100;
    if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    }
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int s = N / 100;
    if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    }
  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int s = N / 100;
    if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    }
  } main {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int s = N / 100;
    if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int s = N / 100; s N / 100 N 100 if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    } N > (100*s + 10*s + s) N (100*s + 10*s + s) 100*s + 10*s + s 100*s 100 s 10*s 10 s s {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } System.out.println(100*(s+1) + 10*(s+1) + (s+1)) System.out.println System.out System System.out 100*(s+1) + 10*(s+1) + (s+1) 100*(s+1) + 10*(s+1) + (s+1) 100*(s+1) 100 (s+1) s 1 10*(s+1) 10 (s+1) s 1 (s+1) s 1 {
      System.out.println(100*s + 10*s + s);
    } System.out.println(100*s + 10*s + s) System.out.println System.out System System.out 100*s + 10*s + s 100*s + 10*s + s 100*s 100 s 10*s 10 s s String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int s = N / 100;
    if(N > (100*s + 10*s + s)) {
      System.out.println(100*(s+1) + 10*(s+1) + (s+1));
    } else {
      System.out.println(100*s + 10*s + s);
    }
  }
}