import java.util.*;
class Main {
  public static void main (String[] args) {
      
      Scanner scan = new Scanner(System.in);
      
      int x = scan.nextInt();
      
      int y =0;
      
      for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          }
         System.out.println(y);
         }
        
} import java.util.*; util.* java class Main {
  public static void main (String[] args) {
      
      Scanner scan = new Scanner(System.in);
      
      int x = scan.nextInt();
      
      int y =0;
      
      for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          }
         System.out.println(y);
         }
        
} Main public static void main (String[] args) {
      
      Scanner scan = new Scanner(System.in);
      
      int x = scan.nextInt();
      
      int y =0;
      
      for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          }
         System.out.println(y);
         } main {
      
      Scanner scan = new Scanner(System.in);
      
      int x = scan.nextInt();
      
      int y =0;
      
      for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          }
         System.out.println(y);
         } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int y =0; y 0 for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          } int i=1; int i=1; i 1 i<10 i 10 i++ i++ i {
        y = 111*i;
        if(y>=x){
          break;
          }
          } {
        y = 111*i;
        if(y>=x){
          break;
          }
          } y = 111*i y 111*i 111 i if(y>=x){
          break;
          } y>=x y x {
          break;
          } break; System.out.println(y) System.out.println System.out System System.out y String[] args args
import java.util.*;
class Main {
  public static void main (String[] args) {
      
      Scanner scan = new Scanner(System.in);
      
      int x = scan.nextInt();
      
      int y =0;
      
      for(int i=1; i<10; i++){
        y = 111*i;
        if(y>=x){
          break;
          }
          }
         System.out.println(y);
         }
        
}