import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class number_dk {
	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

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

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

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}

	
	void solve() throws IOException {
		System.err.println(System.currentTimeMillis());
		String s;
		s = nextLine();
		BigInteger a = new BigInteger(s);
		BigInteger two = new BigInteger("2");
		BigInteger b;
		System.err.println(System.currentTimeMillis());
		b = (a.divide(two)).add(a.mod(two)) ;
		int kol;
		kol = b.toString().length();
		int len = kol * 2 - 1;
		
		String st = "0";
		for (int i = 0; i < kol - 1; i++) {
			st += "9";
		}
		BigInteger nine = new BigInteger(st);
		nine = nine.multiply(two);
		assert(a.compareTo(nine) == 1);
		
		st = "9";
		for (int i = 0; i < kol - 1; i++) {
			st += "0";
		}
		BigInteger ten = new BigInteger(st);
		nine = nine.add(ten);
		if (a.compareTo(nine) == 1) {
			len++;
			a = a.subtract(nine);
		} else {
			nine = nine.subtract(ten);
			a = a.subtract(nine);
		}

		System.err.println(System.currentTimeMillis());
		//
		st = "0";
		for (int i = 0; i < kol - 1; i++) {
			st += "9";
		}
		BigInteger answer = new BigInteger(st);
		answer = answer.add(a);
		st = answer.toString();
		for (int i = 0; i < st.length(); i++) {
			out.print(st.charAt(i));
		}
		int j = st.length() - 1;
		if (len % 2 == 1) j--;
		for (j = j; j >= 0; j--) {
			out.print(st.charAt(j));
		}
		System.err.println(System.currentTimeMillis());
	}
	void run() throws IOException {
		 br = new BufferedReader(new FileReader("number.in"));
		 out = new PrintWriter("number.out");
		// br = new BufferedReader(new InputStreamReader(System.in));
		// out = new PrintWriter(System.out);
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		// Localea.setDefault(Locale.US);
		new number_dk().run();
	}
}