// Задача "Счастливый билет"
// XVI командный чемпионат школьников Санкт-Петербурга по программированию
// Автор задачи: Владимир Ульянцев, ulyantsev@rain.ifmo.ru
// Автор решения: Сергей Поромов, poromov@rain.ifmo.ru

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

public class lucky_sp_wrong2 implements Runnable {

	public static void main(String[] args) {
		new Thread(new lucky_sp_wrong2()).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();
		myAssert(n >= 1 && n <= 100, "Wrong n");
		int[] a = new int[2 * n];
		for (int i = 0; i < n; i++) {
			myAssert(s.charAt(i) >= '0' && s.charAt(i) <= '9', "Not a number");
			a[i] = s.charAt(n - i - 1) - '0';
		}
		myAssert(s.charAt(0) != '0', "Leading zeroes");

		{
			int i = 0;
			while (a[i] == 9) {
				i++;
			}
			a[i]++;
			for (i--; i >= 0; i--) {
				a[i] = 0;
			}
		}

		int s1 = 0;
		int s2 = 0;
		for (int i = 0; i < 2 * n; i++) {
			if (i % 2 == 0) {
				s1 += a[i];
			} else {
				s2 += a[i];
			}
		}

		int t = Math.abs(s1 - s2);
		int last= 0;
		for (int i = 0; i < 2 * n; i++) {
			if (t == 0) {
				break;
			}
			if ((s1 < s2 && i % 2 == 0) || (s1 > s2 && i % 2 == 1)) {
				if (t >= 9 - a[i]) {
					t -= 9 - a[i];
					a[i] = 9;
					last = i;
				} else {
					a[i] += t;
					t = 0;
					last = i;
				}
			} else {
				if (t > a[i]) {
					t -= a[i];
					a[i] = 0;
					last = i;
				} else {
					a[i] -= t - 1;
					t = 1;
					last = i;
					int j = i + 1;
					while (a[j] == 9) {
						j++;
					}
					if ((j - i) % 2 == 1) {
						a[j]++;
						last = j;
						t = 0;
						continue;
					}
					if (a[i] >= 2) {
						a[i] -= 2;
						a[j]++;
						last = j;
						t = 0;
					}
				}
			}
		}
		int i = last - 1;
		int i2 = i - 1;
		while (i >= 0 && i2 >= 0) {
			int tt = Math.min(a[i], a[i2]);
			a[i] -= tt;
			a[i2] -= tt;
			if (a[i] == 0) {
				i -= 2;
			}
			if (a[i2] == 0) {
				i2 -= 2;
			}
		}
		i = 2 * n - 1;
		while (a[i] == 0) {
			i--;
		}
		for (; i >= 0; i--) {
			out.print(a[i]);
		}
	}
}
