import java.io.*;
import hsa.Console;

// The "Rhombus" class.
public class Problem3
{
    public static void main (String[] args) throws IOException
    {

	// Open up the input and output file for IO purpose
	FileReader inFile = new FileReader ("DATA3.txt");
	FileWriter outFile = new FileWriter ("OUT3.txt");

	// Link the input and output file for
	BufferedReader in = new BufferedReader (inFile);
	BufferedWriter out = new BufferedWriter (outFile);

	// String e;
	String input;
	int length, comNum, sum = 0;
	int[] GG = new int [8];

	// Keep reading as long as not end of file (eof)
	while ((input = in.readLine ()) != null)
	{
	    String begin = "00000000", compare = "";
	    length = input.length ();
	    int count = 0;
	    int answer = 0;

	    Loop_1:
	    while (true)
	    {
		GG [0] = Integer.parseInt (begin.charAt (0) + "");
		GG [1] = Integer.parseInt (begin.charAt (1) + "");
		GG [2] = Integer.parseInt (begin.charAt (2) + "");
		GG [3] = Integer.parseInt (begin.charAt (3) + "");
		GG [4] = Integer.parseInt (begin.charAt (4) + "");
		GG [5] = Integer.parseInt (begin.charAt (5) + "");
		GG [6] = Integer.parseInt (begin.charAt (6) + "");
		GG [7] = Integer.parseInt (begin.charAt (7) + "");

		comNum = length - 1;
		count = 0;
		compare = "";
		
		Loop_2:
		while (true)
		{
		    for (int a = count ; a <= comNum ; a++)
		    {
			compare += "" + begin.charAt (a);
		    }

		    


		    if (input.equalsIgnoreCase (compare))
		    {
			break;
		    }

		    else
		    {
			count++;
			comNum++;
			compare = "";
			if (comNum == 8)
			{

			    for (int b = 0 ; b <= 7 ; b++)
			    {
				answer += GG [b];

			    }

			    break;
			}
			else
			{
			    continue;
			}
		    }
		}


		if (begin.equalsIgnoreCase ("11111111"))
		{
		    break;
		}

		for (int c = 7 ; c >= 0 ; c--)
		{
		    if (GG [c] == 0)
		    {
			GG [c] = 1;
			for (int d = c + 1 ; d <= 7 ; d++)
			{
			    GG [d] = 0;
			}
			break;
		    }
		}


		begin = "";

		for (int c = 0 ; c <= 7 ; c++)
		{
		    begin += "" + GG [c];
		}

	    }

	    out.write (answer + "");
	    out.newLine ();


	}

	out.flush ();
	out.close ();


    }




}


// main method
// End of Class



