import java.util.Scanner;
 
public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	}
	public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	}
	public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	}
} Main public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int val = scan.nextInt(); val scan.nextInt() scan.nextInt scan int base = (val / 100); base (val / 100) val 100 if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		} val <= getVal(base) val getVal(base) getVal base {
			System.out.println(getVal(base));
		} System.out.println(getVal(base)) System.out.println System.out System System.out getVal(base) getVal base {
			base++;
			System.out.println(getVal(base));
		} base++ base System.out.println(getVal(base)) System.out.println System.out System System.out getVal(base) getVal base String args[] args public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	} getVal {
		return base * 100 + base * 10 + base;
	} return base * 100 + base * 10 + base; base * 100 + base * 10 + base base * 100 + base * 10 + base base * 100 base 100 base * 10 base 10 base int base base public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	}
	public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	}
} public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	}
	public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	}
} Main
import java.util.Scanner;
 
public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int val = scan.nextInt();
		int base = (val / 100);
		if (val <= getVal(base)) {
			System.out.println(getVal(base));
		} else {
			base++;
			System.out.println(getVal(base));
		}
	}
	public static int getVal(int base) {
		return base * 100 + base * 10 + base;
	}
}