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