#!/usr/bin/env python
def big(s, n):
r = str(s)
if s == '9' and n > 0:
r += '8'
n -= 1
r += '98' * (n // 2)
if n % 2 != 0:
r += '9'
return r
def small(s, n):
r = str(s)
if s == '0' and n > 0:
r += '1'
n -= 1
r += '01' * (n // 2)
if n % 2 != 0:
r += '0'
return r
def main():
s = raw_input().strip()
si = int(s)
diff = None
r = []
last = None
for i, c in enumerate(s):
ci = int(c)
if last is None or (last + ci) % 2 == 0:
if ci > 0:
x = int(s[:i] + big(ci - 1, len(s) - i - 1))
d = abs(x - si)
if diff is None or d < diff:
diff = d
r = [x]
elif d == diff:
r.append(x)
if ci < 9:
x = int(s[:i] + small(ci + 1, len(s) - i - 1))
d = abs(x - si)
if diff is None or d < diff:
diff = d
r = [x]
elif d == diff:
r.append(x)
else:
if ci > 1:
x = int(s[:i] + big(ci - 2, len(s) - i - 1))
d = abs(x - si)
if diff is None or d < diff:
diff = d
r = [x]
elif d == diff:
r.append(x)
if ci < 8:
x = int(s[:i] + small(ci + 2, len(s) - i - 1))
d = abs(x - si)
if diff is None or d < diff:
diff = d
r = [x]
elif d == diff:
r.append(x)
if last is not None and (last + ci) % 2 == 0:
break
last = ci
print ' '.join(map(str, sorted(r)))
if __name__ == '__main__':
main()