import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%111 == 0) {
	    System.out.println(N);
	    return;
	}
	int num = N/111+1;
	System.out.println(num*100+num*10+num);
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%111 == 0) {
	    System.out.println(N);
	    return;
	}
	int num = N/111+1;
	System.out.println(num*100+num*10+num);
    }
} Main public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%111 == 0) {
	    System.out.println(N);
	    return;
	}
	int num = N/111+1;
	System.out.println(num*100+num*10+num);
    } main {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%111 == 0) {
	    System.out.println(N);
	    return;
	}
	int num = N/111+1;
	System.out.println(num*100+num*10+num);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc if(N%111 == 0) {
	    System.out.println(N);
	    return;
	} N%111 == 0 N%111 N 111 0 {
	    System.out.println(N);
	    return;
	} System.out.println(N) System.out.println System.out System System.out N return; int num = N/111+1; num N/111+1 N/111 N 111 1 System.out.println(num*100+num*10+num) System.out.println System.out System System.out num*100+num*10+num num*100+num*10+num num*100 num 100 num*10 num 10 num String[] args args
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	if(N%111 == 0) {
	    System.out.println(N);
	    return;
	}
	int num = N/111+1;
	System.out.println(num*100+num*10+num);
    }
}