import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    } int i = n; int i = n; i n i<1000 i 1000 i++ i++ i {
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    } {
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    } String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i s = s.replace(s.substring(0,1),"") s s.replace(s.substring(0,1),"") s.replace s s.substring(0,1) s.substring s 0 1 "" if(s.length()==0){
        System.out.println(i);
        return;
      } s.length()==0 s.length() s.length s 0 {
        System.out.println(i);
        return;
      } System.out.println(i) System.out.println System.out System System.out i return; String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = n;i<1000;i++){
      String s = String.valueOf(i);
      s = s.replace(s.substring(0,1),"");
      if(s.length()==0){
        System.out.println(i);
        return;
      }
    }
  }
}
