import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	}
}

 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int i = n; i n for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		} ; i <= 999 i 999 i++ i++ i {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		} {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		} int a = i / 100; a i / 100 i 100 int b = (i / 10) % 10; b (i / 10) % 10 (i / 10) i 10 10 int c = i % 10; c i % 10 i 10 if (a == b && b == c && c == a) break; a == b && b == c && c == a a == b && b == c && c == a a == b a b b == c b c c == a c a break; System.out.println(i) System.out.println System.out System System.out i 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();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int i = n;
		for (; i <= 999; i++) {
			int a = i / 100;
			int b = (i / 10) % 10;
			int c = i % 10;
			
			if (a == b && b == c && c == a) break;
		}
		
		System.out.println(i);
		
		sc.close();
	}
}


