import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  } main {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int i = 1; i 1 while(111*i < N) {
      i++;
    } 111*i < N 111*i 111 i N {
      i++;
    } i++ i System.out.println(111*i) System.out.println System.out System System.out 111*i 111 i String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int N = Integer.parseInt(sc.next());
    
    int i = 1;
    while(111*i < N) {
      i++;
    }
    
    System.out.println(111*i);
    
  }
}