import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 }
} import java.util.*; util.* java public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 }
} Main public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 } main {
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) double N = sc.nextDouble(); N sc.nextDouble() sc.nextDouble sc int sss = (int)Math.ceil(N/111); sss (int)Math.ceil(N/111) Math.ceil Math N/111 N 111 System.out.println(111*sss) System.out.println System.out System System.out 111*sss 111 sss String[] args args public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 }
} public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 }
} Main
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   double N = sc.nextDouble();

   int sss = (int)Math.ceil(N/111);
   System.out.println(111*sss);
 }
}