import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc char ch[] = String.valueOf(N).toCharArray(); ch String.valueOf(N).toCharArray() String.valueOf(N).toCharArray String.valueOf(N) String.valueOf String N char x = ch[0]; x ch[0] ch 0 char ans[] = {x,x,x}; ans {x,x,x} x x x int di = Integer.parseInt(String.valueOf(ans)); di Integer.parseInt(String.valueOf(ans)) Integer.parseInt Integer String.valueOf(ans) String.valueOf String ans if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    } di>=N di N {
      System.out.println(di);
    } System.out.println(di) System.out.println System.out System System.out di {
      di+=111;
      System.out.println(di);
    } di+=111 di 111 System.out.println(di) System.out.println System.out System System.out di String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    char ch[] = String.valueOf(N).toCharArray();
    char x = ch[0];
    char ans[] = {x,x,x};
    int di = Integer.parseInt(String.valueOf(ans));
    if(di>=N){
      System.out.println(di);
    }else{
      di+=111;
      System.out.println(di);
    }
  }
}