import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

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

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

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

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

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

    int N = scanner.nextInt();
    int t = N / 100;
    if (N > t * 111) {
      System.out.println((t + 1) * 111);
    } else {
      System.out.println(t * 111);
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int t = N / 100;
    if (N > t * 111) {
      System.out.println((t + 1) * 111);
    } else {
      System.out.println(t * 111);
    }
  }
}
