import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  } main {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int x = N; x N while(x > 0)
      x /= 10; x > 0 x 0 x /= 10 x 10 while(!(N <= 10*10*x + 10*x + 1*x))
      x++; !(N <= 10*10*x + 10*x + 1*x) (N <= 10*10*x + 10*x + 1*x) N 10*10*x + 10*x + 1*x 10*10*x + 10*x + 1*x 10*10*x 10*10*x 10 10 x 10*x 10 x 1*x 1 x x++ x System.out.println(10*10*x + 10*x + 1*x) System.out.println System.out System System.out 10*10*x + 10*x + 1*x 10*10*x + 10*x + 1*x 10*10*x 10*10*x 10 10 x 10*x 10 x 1*x 1 x String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
} Main
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int x = N;

    while(x > 0)
      x /= 10;

    while(!(N <= 10*10*x + 10*x + 1*x))
      x++;

    System.out.println(10*10*x + 10*x + 1*x);

  }
}
