import java.util.*;
class Main {
  public static void main(String[] args) {
    
    Scanner scan =new Scanner(System.in);
    int n = scan.nextInt();
    int arr[] = {111,222,333,444,555,666,777,888,999} ;
    int i = 0 ;
    while(n>arr[i]){
      i++;
    }
    System.out.println(arr[i]);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    
    Scanner scan =new Scanner(System.in);
    int n = scan.nextInt();
    int arr[] = {111,222,333,444,555,666,777,888,999} ;
    int i = 0 ;
    while(n>arr[i]){
      i++;
    }
    System.out.println(arr[i]);
  }
} Main public static void main(String[] args) {
    
    Scanner scan =new Scanner(System.in);
    int n = scan.nextInt();
    int arr[] = {111,222,333,444,555,666,777,888,999} ;
    int i = 0 ;
    while(n>arr[i]){
      i++;
    }
    System.out.println(arr[i]);
  } main {
    
    Scanner scan =new Scanner(System.in);
    int n = scan.nextInt();
    int arr[] = {111,222,333,444,555,666,777,888,999} ;
    int i = 0 ;
    while(n>arr[i]){
      i++;
    }
    System.out.println(arr[i]);
  } Scanner scan =new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int arr[] = {111,222,333,444,555,666,777,888,999} ; arr {111,222,333,444,555,666,777,888,999} 111 222 333 444 555 666 777 888 999 int i = 0 ; i 0 while(n>arr[i]){
      i++;
    } n>arr[i] n arr[i] arr i {
      i++;
    } i++ i System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i String[] args args
import java.util.*;
class Main {
  public static void main(String[] args) {
    
    Scanner scan =new Scanner(System.in);
    int n = scan.nextInt();
    int arr[] = {111,222,333,444,555,666,777,888,999} ;
    int i = 0 ;
    while(n>arr[i]){
      i++;
    }
    System.out.println(arr[i]);
  }
}
