#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
    int n,a[9]={111,222,333,444,555,666,777,888,999};
    cin>>n;
    for(int i=0;i<9;i++){
    	if(n<=a[i]) {
	cout<<a[i]<<endl;
	return 0;
	}
		
    }
    
    


    
    

   	

   return 0;
}

#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  cout << ((n + 110) / 111) * 111 << endl;
}
