import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.ArrayList; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author durec4 */ public class More { StringTokenizer st = new StringTokenizer(" "); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); boolean hasNextToken() throws IOException { while (!st.hasMoreTokens()) { String line = input.readLine(); if (line == null) { return false; } st = new StringTokenizer(line); } return true; } String nextToken() throws IOException { return (!hasNextToken()) ? null : st.nextToken(); } public static void main(String[] args) throws Exception { More instance = new More(); while (instance.hasNextToken()) { instance.run(); } } void run() throws Exception { String s = nextToken(); long cislo = Long.parseLong(s); byte[] poleByte = new byte[s.length()]; int index = 0; while (cislo > 0) { poleByte[index] = (byte) (cislo % 10); index++; cislo /= 10; } boolean prenos = true; ArrayList newPole = new ArrayList(); for (int i = 0;; i++) { if (prenos) { if (i % 2 == 0) { if (i >= poleByte.length) { newPole.add(1); prenos = false; } else if (poleByte[i] == 0) { newPole.add(1); prenos = false; } else { newPole.add(0); prenos = true; } } else { if (i >= poleByte.length) { newPole.add(1); prenos = true; } else if (poleByte[i] == 0) { newPole.add(1); prenos = true; } else { newPole.add(0); prenos = false; } } } else { if (i >= poleByte.length) { newPole.add(0); prenos = false; break; } else { newPole.add(poleByte[i]); } } } boolean bolaJedna = false; String result = ""; for (int i = newPole.size()-1; i >= 0; i--) { if (bolaJedna == false) { if (newPole.get(i) == 0) { continue; } else { bolaJedna = true; result += newPole.get(i); //System.out.print(newPole[i]); } } else { result += newPole.get(i); //System.out.print(newPole[i]); } } if (result == "") System.out.println("0"); else System.out.println(result); } }