import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    System.out.println((sc.nextInt()+110)/111*111);
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    System.out.println((sc.nextInt()+110)/111*111);
  }
} Main public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    System.out.println((sc.nextInt()+110)/111*111);
  } main {
    Scanner sc=new Scanner(System.in);
    System.out.println((sc.nextInt()+110)/111*111);
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) System.out.println((sc.nextInt()+110)/111*111) System.out.println System.out System System.out (sc.nextInt()+110)/111*111 (sc.nextInt()+110)/111 (sc.nextInt()+110) sc.nextInt() sc.nextInt sc 110 111 111 String[] args args
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    System.out.println((sc.nextInt()+110)/111*111);
  }
}