#include <sstream>
#include <fstream>
#include <iostream>
#include <math.h>
 
using namespace std;

ifstream in ("DATA3.txt");
ofstream out ("OUT3.txt");

int main ()
{
    freopen ("DATA3.txt", "r", stdin);
    freopen ("OUT3.txt", "w", stdout);
  
   for (int ab= 0; ab<5; ab++)
    {
        string a; 
        in >> a;
    string ab [16];
    ab [0] = "0000";
      ab [1] = "0001";
        ab [2] = "0010";
  ab [3] = "0011";
    ab [4] = "0100";
       ab [5] = "0101";
         ab [6] = "0110";
           ab [7] = "0111";
             ab [8] = "1000";
               ab [9] = "1001";
                 ab [10] = "1010";
                   ab [11] = "1011";
                     ab [12] = "1100";
                       ab [13] = "1101";
                         ab [14] = "1110";
                           ab [15] = "1111";
                        
                      int j = a.length ();    
                  
                for (int p = 0; p < 16; p++)
                   {
                       bool po = true;
                       for (int m = 0; m < 5-j; m++)
                       {
                           if ( ab[p].substr (m, j) == a)
                           {
                                po = false;
                                break;
                            }
                       }
                
                       if (po == true)
                       {
                              cout << ab [p] << "\n";
                          }
                   }
                           
    }
}
 

