// Задача ""
// ??-ая Интернет-олимпиада сезона 2007-2008, базовый уровень
// Автор задачи: Федор Царев, tsarev@rain.ifmo.ru
// Автор решения: Сергей Поромов, poromov@rain.ifmo.ru

import java.io.*;
import java.util.*;

public class lucky_sp2 implements Runnable {

	public static void main(String[] args) {
		new Thread(new lucky_sp2()).run();
	}

	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FILENAME + ".in"));
			out = new PrintWriter(FILENAME + ".out");
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	BufferedReader br;

	PrintWriter out;

	StringTokenizer st;

	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean e, String s) {
		if (!e) {
			throw new Error("Assertion failure " + s);
		}
	}

	private static final String FILENAME = "lucky";

	public void solve() throws IOException {
		String s = br.readLine();
		int n = s.length() + 1;
		int[] a = new int[n];
		for (int i = 0; i < n - 1; i++) {
			a[i + 1] = s.charAt(i) - '0';
		}
		int last = 0;
		int s1 = 0;
		int s2 = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] < 9) {
				if ((i & 1) == 0) {
					if (s1 >= s2) {
						int t = (n / 2 - i / 2) * 9;
						if (s1 + a[i] + 1 <= s2 + t) {
							last = i;
						}
					}
					if (s1 < s2) {
						int t = 9 * ((n + 1) / 2 - (i + 1) / 2);
						if (s1 + t >= s2 && (s2 - s1 > a[i] || i != n - 1)) {
							last = i;
						}
					}
				} else {
					if (s1 <= s2) {
						int t = ((n + 1) / 2 - (i + 2) / 2) * 9;
						if (s1 + t >= s2 + a[i] + 1) {
							last = i;
						}
					}
					if (s1 > s2) {
						int t = (n / 2 - i / 2) * 9;
						if (s2 + t >= s1 && (s1 - s2 > a[i] || i != n - 1)) {
							last = i;
						}
					}
				}
			}
			if (i == n)
				break;
			if ((i & 1) == 0) {
				s1 += a[i];
			} else {
				s2 += a[i];
			}
		}
		s1 = 0;
		s2 = 0;
		for (int i = 0; i < last; i++) {
			if ((i & 1) == 0) {
				s1 += a[i];
			} else {
				s2 += a[i];
			}
		}
		a[last]++;
		if ((last & 1) == 0) {
			s1 += a[last];
		} else {
			s2 += a[last];
		}
		if (s1 > s2) {
			int t = s1 - s2;
			for (int i = n - 1; i > last; i--) {
				if ((i & 1) == 1) {
					int tt = Math.min(t, 9);
					t -= tt;
					a[i] = tt;
				} else {
					a[i] = 0;
				}
			}
			if (t > 0) {
				a[last] += t;
			}
		} else {
			int t = s2 - s1;
			for (int i = n - 1; i > last; i--) {
				if ((i & 1) == 0) {
					int tt = Math.min(t, 9);
					t -= tt;
					a[i] = tt;
				} else {
					a[i] = 0;
				}
			}
			if (t > 0) {
				a[last] += t;
			}
		}
		int i = 0;
		while (a[i] == 0) {
			i++;
		}
		for (; i < n; i++) {
			out.print((char)(a[i] + '0'));
		}
	}
}
