#include <bits/stdc++.h>
using namespace std;
inline int toInt ( char c ) { return c - '0'; }
inline char toChar ( int i ) { return i + '0'; }
string rlz ( const string& s ) {
int i = 0;
while ( i < s.size() && s[i] == '0' ) i++;
if ( i == s.size() ) return "0";
return s.substr ( i, s.size() - i );
}
int compare ( const string& a, const string& b ) {
if ( a.size() != b.size() )
return ( a.size() < b.size() ? -1 : 1 );
for ( int i = 0; i < int(a.size()); ++i )
if ( a[i] != b[i] )
return ( a[i] < b[i] ? -1 : 1 );
return 0;
}
string subtract ( const string& a, const string& _b ) {
assert ( compare(a, _b) >= 0 );
const int n = a.size();
string b = string(n - _b.size(), '0') + _b;
string c ( n, '0' );
int carry = 0;
for ( int i = n - 1; i >= 0; --i ) {
int dgt = toInt(a[i]) - toInt(b[i]) - carry;
carry = 0;
if ( dgt < 0 ) { dgt += 10; carry++; }
c[i] = toChar(dgt);
}
assert ( carry == 0 );
return rlz ( c );
}
string s;
string r;
int n;
bool goUpper ( int i, bool eq ) {
if ( i == n ) {
if ( eq ) return false;
return true;
}
for ( char c = ( eq ? s[i] : '0'); c <= '9'; ++c ) {
if ( i > 0 )
if ( (toInt(c) - toInt(r[i - 1])) % 2 == 0 )
continue;
r[i] = c;
if (goUpper(i + 1, (eq && c == s[i]))) {
return true;
}
}
return false;
}
bool goLower ( int i, bool eq ) {
if ( i == n ) {
if ( eq ) return false;
return true;
}
for ( char c = ( eq ? s[i] : '9'); c >= '0'; --c ) {
if ( i > 0 )
if ( (toInt(c) - toInt(r[i - 1])) % 2 == 0 )
continue;
r[i] = c;
if ( goLower(i + 1, (eq && c == s[i])) )
return true;
}
return false;
}
string getUpper ( )
{
string maxS = "";
for ( int i = 0; i < n; ++i )
maxS += '9' - (i % 2);
if ( compare(maxS, s) <= 0 ) {
string r = "";
for ( int i = 0; i < n + 1; ++i )
r += toChar(1 - (i % 2));
return r;
}
assert ( goUpper(0, 1) );
return r;
}
string getLower ( ) {
assert ( goLower(0, 1) );
return r;
}
int main ( )
{
cin >> s;
s = rlz(s);
r = s;
n = s.size();
if ( s == "0" ) cout << getUpper() << endl;
else {
string hi = getUpper();
string lo = getLower();
int diff = compare ( subtract(hi, s), subtract(s, lo) );
if ( diff == 0 ) cout << lo << " " << hi << endl;
else if ( diff == -1 ) cout << hi << endl;
else cout << lo << endl;
}
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}