import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		StringBuffer sb = new StringBuffer();
		for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		}
	}

	static boolean check(int n)
	{
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	}
} import java.util.*; util.* java class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		StringBuffer sb = new StringBuffer();
		for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		}
	}

	static boolean check(int n)
	{
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		StringBuffer sb = new StringBuffer();
		for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		StringBuffer sb = new StringBuffer();
		for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc StringBuffer sb = new StringBuffer(); sb new StringBuffer() for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		} int i=n; int i=n; i n i<=999 i 999 i++ i++ i {
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		} {
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		} if(check(i))
			{
				System.out.println(i);
				break;
			} check(i) check i {
				System.out.println(i);
				break;
			} System.out.println(i) System.out.println System.out System System.out i break; String[] args args static boolean check(int n)
	{
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	} check {
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	} int x=n%10; x n%10 n 10 n/=10 n 10 if(n%10!=x)
			return false; n%10!=x n%10 n 10 x return false; false n/=10 n 10 if(n%10!=x)
			return false; n%10!=x n%10 n 10 x return false; false return true; true int n n
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		StringBuffer sb = new StringBuffer();
		for(int i=n;i<=999;i++)
		{
			if(check(i))
			{
				System.out.println(i);
				break;
			}

		}
	}

	static boolean check(int n)
	{
		int x=n%10;
		n/=10;
		if(n%10!=x)
			return false;
		n/=10;
		if(n%10!=x)
			return false;
		return true;
	}
}