import java.util.Scanner;

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

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n;
		n=sc.nextInt();
		char ch[] = String.valueOf(n).toCharArray();
		char x = ch[0];
		char ans[]= {x,x,x};
		int di = Integer.parseInt(String.valueOf(ans));
		if(di>=n)
			System.out.println(di);
		else
		{
			di=di+111;
			System.out.println(di);
		}
		
	}
}
