import java.util.*;

class Main {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in); 
		String s=sc.next();
		int i=0;
		if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111);
		
	}
} import java.util.*; util.* java class Main {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in); 
		String s=sc.next();
		int i=0;
		if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111);
		
	}
} Main public static void main (String[] args) {
		Scanner sc=new Scanner(System.in); 
		String s=sc.next();
		int i=0;
		if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111);
		
	} main {
		Scanner sc=new Scanner(System.in); 
		String s=sc.next();
		int i=0;
		if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111);
		
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc int i=0; i 0 if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111); Integer.parseInt(s)<=(s.charAt(i)-'0')*111 Integer.parseInt(s) Integer.parseInt Integer s (s.charAt(i)-'0')*111 (s.charAt(i)-'0') s.charAt(i) s.charAt s i '0' 111 System.out.print((s.charAt(i)-'0')*111) System.out.print System.out System System.out (s.charAt(i)-'0')*111 (s.charAt(i)-'0') s.charAt(i) s.charAt s i '0' 111 System.out.print((s.charAt(i)-'0'+1)*111) System.out.print System.out System System.out (s.charAt(i)-'0'+1)*111 (s.charAt(i)-'0'+1) s.charAt(i)-'0' s.charAt(i) s.charAt s i '0' 1 111 String[] args args
import java.util.*;

class Main {
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in); 
		String s=sc.next();
		int i=0;
		if(Integer.parseInt(s)<=(s.charAt(i)-'0')*111)
		    System.out.print((s.charAt(i)-'0')*111);
		else
		    System.out.print((s.charAt(i)-'0'+1)*111);
		
	}
}