#include <iostream>
#include <stdio.h>
#include <vector> 
#include <math.h> 
using namespace std;
int main(void){
    int N; cin >> N;
    int i = 0;
    int answer = 0;
    if (N / 100 > (N - N / 100 * 100) / 10) answer = N / 100;
    else if (N / 100 < (N - N / 100 * 100) / 10) answer = N / 100 + 1;
    else if ((N - N / 100 * 100) / 10 >= N % 10) answer = N / 100;
    else answer = N / 100 + 1;
    cout << answer << answer << answer << endl;
}
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//227
	int i;
	cin>>i;
	for(;i<=999;i++) {
		if(i%10==(i%100)/10&&i%10==i/100){
			cout<<i;
			return;
		}
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	
