import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  }
 } import java.util.*; util.* java public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  }
 } Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int x = 0; x 0 if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=111 n 111 {
      x = 111;
    } x = 111 x 111 if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=222 n 222 {
      x = 222;
    } x = 222 x 222 if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=333 n 333 {
      x = 333;
    } x = 333 x 333 if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=444 n 444 {
      x = 444;
    } x = 444 x 444 if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=555 n 555 {
      x = 555;
    } x = 555 x 555 if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=666 n 666 {
      x = 666;
    } x = 666 x 666 if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=777 n 777 {
      x = 777;
    } x = 777 x 777 if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    } n<=888 n 888 {
      x = 888;
    } x = 888 x 888 if(n<=999){
      x = 999;
    } n<=999 n 999 {
      x = 999;
    } x = 999 x 999 System.out.println(x) System.out.println System.out System System.out x String args[] args public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  }
 } public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  }
 } Main
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;
    if(n<=111){
      x = 111;
    }else if(n<=222){
      x = 222;
    }else if(n<=333){
      x = 333;
    }else if(n<=444){
      x = 444;
    }else if(n<=555){
      x = 555;
    }else if(n<=666){
      x = 666;
    }else if(n<=777){
      x = 777;
    }else if(n<=888){
      x = 888;
    }else if(n<=999){
      x = 999;
    }
    System.out.println(x);
  }
 }
