import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
	public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	}
} 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 ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
	public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int flag = 0; flag 0 for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		} int i=N; int i=N; i N i<1000 i 1000 i++ i++ i {
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		} {
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		} flag = sepNumber(i) flag sepNumber(i) sepNumber i if(flag == 1){
				ans = i;
				break;
			} flag == 1 flag 1 {
				ans = i;
				break;
			} ans = i ans i break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	} sepNumber {
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	} String s = String.valueOf(x); s String.valueOf(x) String.valueOf String x String[] sep = s.split(""); sep s.split("") s.split s "" int tr = 0; tr 0 if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		} sep[0].equals(sep[1]) && sep[1].equals(sep[2]) sep[0].equals(sep[1]) sep[0].equals sep[0] sep 0 sep[1] sep 1 sep[1].equals(sep[2]) sep[1].equals sep[1] sep 1 sep[2] sep 2 {
			tr = 1;
		} tr = 1 tr 1 return(tr); (tr) int x x public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
	public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
	public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 0;
		int flag = 0;
		for(int i=N; i<1000; i++){
			flag = sepNumber(i);
			if(flag == 1){
				ans = i;
				break;
			}
		}
		System.out.println(ans);
	}
	public static int sepNumber(int x){
		String s = String.valueOf(x);
		String[] sep = s.split("");
		int tr = 0;
		if(sep[0].equals(sep[1]) && sep[1].equals(sep[2])){
			tr = 1;
		}
		return(tr);
	}
}
