import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

} import java.util.*; util.* java public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

} Main static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		} solve {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int mult = 0; mult 0 for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			} int i = 0; int i = 0; i 0 i<=999 i 999 i+=111 i+=111 i 111 {
				if(n>i) {
					mult++;
				}
			} {
				if(n>i) {
					mult++;
				}
			} if(n>i) {
					mult++;
				} n>i n i {
					mult++;
				} mult++ mult System.out.println(mult*111) System.out.println System.out System System.out mult*111 mult 111 sc.close() sc.close sc public static void main(String[] args) {
		solve();

	} main {
		solve();

	} solve() solve String[] args args public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

} public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

} Main
import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int mult = 0;
			for(int i = 0;i<=999;i+=111) {
				if(n>i) {
					mult++;
				}
			}
			System.out.println(mult*111);
			sc.close();
		}
	public static void main(String[] args) {
		solve();

	}

}
