#include <bits/stdc++.h>
#define ll long long int

using namespace std;

bool de(double a, double b){
    if (abs(a-b)<0.00001)
        return true;
    if (max(a,b)/min(a,b)<1.00001)
        return true;
    else return false;
}

map<ll,ll> m;

int main(){
    int zc=0,oc=0;
    ll tmp=1, gap=2, index=2;
    while(tmp<=1000000000){
        m[tmp]=index;
       // cout<<"tmp = "<<tmp<<" - "<<m[tmp]<<endl;
        tmp+=gap;
        gap++;
        index++;
    }

    //cout<<m[1000000000]<<endl;

    int a0,a1,a2,a3;
    scanf("%d %d %d %d",&a0, &a1, &a2, &a3);

    int zero=m[a0], one=m[a3];

    if ((a0!=0 || a1!=0 || a2!=0) && a3==0){
        one++;
        m[a3]=1;
    }
    if (a0==0 &&( a1!=0 || a2!=0 || a3!=0)){
        zero++;
        m[a0]=1;
    }

    if (a0==0 && a1==0 && a2==0 && a3==0){
        printf("0");
    }
  /*  else if (a0!=0 && a1==0 && a2==0 && a3==0){
        if (!m[a0])
            cout<<"Impossible\n";
        for(int i=1;i<=m[a0];i++){
            printf("0");
        }
    }
    else if (a0==0 && a1==0 && a2==0 && a3!=0){
         if (!m[a3])
            cout<<"Impossible\n";

         for(int i=1;i<=m[a3];i++){
            printf("1");
        }
    }
    else if (a0==0 && a1==1 && a2==0 && a3==0){
        printf("01");
    }
     else if (a0==0 && a1==0 && a2==1 && a3==0){
        printf("10");
    }*/

    else if (m[a0]==0 || m[a3]==0){
          //  cout<<"first if"<<endl;
        cout<<"Impossible"<<endl;
    }
    else if (a1+a2!=zero*one){
        //cout<<"zero "<<zero<<" one "<<one<<endl;
        cout<<"Impossible"<<endl;
    }
    else {
        bool found=false;
        int len=zero+one;
        int ptr1=zero, ptr2=zero+one;
        int b1=zero*one,b2=0;
        while(b1>a1){
            ptr1--;
            ptr2--;
            b1=ptr1*one;
            b2=one*(len-ptr2);
            if (b1==a1){
                found=true;
                break;
            }
        }
        if (b1==a1)
            found=true;
        int saveLen=len;
        if (!found){
            int last=-1;
            while(b1!=a1){
                int ptr3=ptr2;
                ptr2--;
                bool done=false;
                for(int i=ptr3+1;i<=saveLen;i++){
                    b1++;
                    if (b1==a1){
                        if (i==saveLen){
                            saveLen--;
                        }
                        else last=i;
                        done=true;
                        break;
                    }
                }
                if (!done)
                    saveLen--;
            }

            for(int i=1;i<=ptr1;i++){
                printf("0");zc++;
            }
            for(int i=ptr1+1;i<=ptr2;i++){
                printf("1");oc++;
            }
            if (last!=-1){
                  //  cout<<"last yes\n";
                for(int i=ptr2+1;i<last;i++){
                    printf("0");zc++;
                }
                printf("1");oc++;
                for(int i=last+1;i<=saveLen;i++){
                    printf("0");zc++;
                }
            }
            else {
                for(int i=ptr2+1;i<=saveLen;i++){
                    printf("0");zc++;
                }
            }

            for(int i=saveLen+1;i<=len;i++){
                printf("1");oc++;
            }

        }
        else {
                //cout<<"last else\n";
             for(int i=1;i<=ptr1;i++){
                printf("0");zc++;
            }
            for(int i=ptr1+1;i<=ptr2;i++){
                printf("1");oc++;
            }
            for(int i=ptr2+1;i<=len;i++){
                printf("0");zc++;
            }
        }

    }

    //cout<<"zeroes = "<<zc<<" ones = "<<oc<<endl;

}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	       break;

		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if(a00==0&&a10==0&&a01==0&&a11==0)
	   {  printf("0");
	      return 0;
	   }
	   int f=0;
	   //cout<<z<<" "<<o<<endl;
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	   }
	   else
	   {
	        if(z==0)
	          {  z=1;
	          if((a01+a10)==(z*o))
	         {
				   long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		     f=1;
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	       }
	       z=0;
	      // cout<<z<<" "<<o<<endl;
	      // cout<<"megh"<<endl;
			  }
			if(o==0)
			  {       o=1;
			    // cout<<"megh"<<endl;
			   if((a01+a10)==(z*o))
			   {

			    long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;

	        }
	        o=0;
	       // cout<<z<<" "<<o<<endl;

			  }

		   if(z==0&&o==0)
		   {    z=1;
		        o=1;
		        if((a01+a10)==(z*o))
		        {

		        long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
		   }
	}

			printf("Impossible\n");
			return 0;

		}

	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else if(z<=a10)
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else if(z<=a10)
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   if((int)v.size()!=len)
		   {  printf("Impossible\n");
		      return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	       break;

		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if(a00==0&&a10==0&&a01==0&&a11==0)
	   {  printf("0");
	      return 0;
	   }
	   int f=0;
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	   }
	   else
	   {    if(!f)
	       {   if(z==0)
	          {  z=1;
	             long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		     f=1;
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
			  }
			  else if(o==0)
			  {       o=1;
			    long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
			  }
		   }
		   else if(z==0&&o==0)
		   {    z=1;
		        o=1;
		        long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
		   }
		   else
	        printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=0;
       long long int o=0;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else if(z<=a10)
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=0;
       long long int o=0;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else if(z<=a10)
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   if((int)v.size()!=len)
		   {  printf("Impossible\n");
		      return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;

		 }
	   }
	 //  cout<<z<<endl;
	 //  cout<<o<<endl;
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if(((a01+a10)==0)&&((a00+a11)==0))
	   {   printf("0");
	      return 0;
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	       break;

		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if(a00==0&&a10==0&&a01==0&&a11==0)
	   {  printf("0");
	      return 0;
	   }
	   int f=0;
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	   }
	   else
	   {    if(!f)
	       {   if(z==0)
	          {  z=1;
	          if((a01+a10)==(z*o))
	         {
				   long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		     f=1;
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	       }
			  }
			  else if(o==0)
			  {       o=1;
			   if((a01+a10)==(z*o))
			   {

			    long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	        }
			  }

		   else if(z==0&&o==0)
		   {    z=1;
		        o=1;
		        if((a01+a10)==(z*o))
		        {

		        long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
		   }
	}
		   else
	        {
			printf("Impossible\n");
			return 0;
		  }
		}
	}

	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	       break;

		 }
	   }
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if(a00==0&&a10==0&&a01==0&&a11==0)
	   {  printf("0");
	      return 0;
	   }
	   int f=0;
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
	   }
	   else
	   {    if(!f)
	       {   if(z==0)
	          {  z=1;
	             long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		     f=1;
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
			  }
			  else if(o==0)
			  {       o=1;
			    long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
			  }

		   else if(z==0&&o==0)
		   {    z=1;
		        o=1;
		        long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }

		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
		   return 0;
		   }
		   else
	        {
			printf("Impossible\n");
			return 0;
		  }
		}
	}

	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=0;
       long long int o=0;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;
            break;
		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;
	        break;
		 }
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else if(z<=a10)
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int a00,a01,a10,a11;
long long int ans(long long int x)
{   return (x*(x-1))/2;
}

int main()
{      scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
       long long int z=-1;
       long long int o=-1;
       for(long long int i=0;i<=100000LL;i++)
       {   if(ans(i)==a00)
         {  z=i;

		 }
	   }
	   for(long long int i=0;i<100000LL;i++)
	   {   if(ans(i)==a11)
	     {  o=i;

		 }
	   }
	 //  cout<<z<<endl;
	 //  cout<<o<<endl;
	   if(z==-1||o==-1)
	   {   printf("Impossible");
	      return 0;
	   }
	   if((a10+a01)==(z*o))
	   {      long long int len=z+o;
	        vector<int> v;
	       for(int i=1;i<=len;i++)
	       {   if(o<=a01)
	          {   v.push_back(0);
	              z--;
	              a01-=o;
			  }
			  else
			  {   v.push_back(1);
			      o--;
			      a10-=z;
			  }
		   }
		   if((int)v.size()==0)
		   {   printf("0");
		       return 0;
		   }
		   for(int i=0;i<(int)v.size();i++)
		   {  printf("%d",v[i]);
		   }
	   }
	   else
	   {   printf("Impossible\n");
	   }
	   return 0;
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
		{
			count0=i;
			break;
		}
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
		{
			count1=i;
			break;
		}
	if(count0 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count0++;
	if(count1 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count1++;
	if(count0 == 1 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count0--;
	// printf("%lld %lld %lld\n", count0, count1, (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11);
	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else if(count1 > 0)
		{
			output[i]='1';
			count1--;
			a01-=count0;
		}
	}
	if(stringlength == 0)
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else
			count1--;
	}
	if(count0!=0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
	{
		if(output[i]!='0')
			output[i]='1';
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1+1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else
			count1--;
	}
	if(count0>0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
	{
		if(output[i]!='0')
			output[i]='1';
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
		{
			count0=i;
			break;
		}
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
		{
			count1=i;
			break;
		}
	// printf("%lld %d\n", count0, (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11);
	if(count0 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count0++;
	else if(count1 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count1++;
	else if(count0 == 1 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count0--;
	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else if(count1 > 0)
		{
			output[i]='1';
			count1--;
			a01-=count0;
		}
	}
	if(stringlength == 0)
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
		{
			count0=i;
			break;
		}
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
		{
			count1=i;
			break;
		}
	// printf("%lld %d\n", count0, (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11);
	if(count0 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		count0++;
		printf("oo\n");
	}
	else if(count1 == 0 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count1++;
	else if(count0 == 1 && (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
		count0--;
	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else if(count1 > 0)
		{
			output[i]='1';
			count1--;
			a01-=count0;
		}
	}
	if(count0+count1 == 0)
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else if(count1 > 0)
		{
			output[i]='1';
			count1--;
			a01-=count0;
		}
	}
	if(a01!=0 || a10 !=0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	long long int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%lld %lld %lld %lld",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1 && count0 > 0)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else if (count1 > 0)
			count1--;
	}
	if(count0!=0 || count1!=0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
	{
		if(output[i]!='0')
			output[i]='1';
	}
	for (int i = 0; i < stringlength; ++i)
		printf("%c", output[i]);
	printf("\n");
}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%d %d %d %d",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1+1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a10>=count1)
		{
			output[i]='0';
			count0--;
			a10-=count1;
		}
		else
			count1--;
	}
	if(count0>0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
	{
		if(output[i]!='0')
			output[i]='1';
	}
	printf("%s\n",output);

}


# include <bits/stdc++.h>
using namespace std;

int main()
{
	int a00,a01,a10,a11,count0=-1,count1=-1,allsat=-1;
	scanf("%d %d %d %d",&a00,&a01,&a10,&a11);
	for (int i = 0; i*(i-1)/2 <= a00; ++i)
		if(i*(i-1)/2==a00)
			count0=i;
	for (int i = 0; i*(i-1)/2 <= a11; ++i)
		if(i*(i-1)/2==a11)
			count1=i;
	// printf("%d %d\n", count0, count1);

	if(count0==-1 || count1 == -1 || (count0+count1)*(count0+count1-1)/2!=a00+a01+a10+a11)
	{
		printf("Impossible\n");
		return 0;
	}
	char output[count0+count1+1];
	int stringlength=count0+count1;
	for (int i = count0+count1-1; i >= 0; --i)
		output[i]=0;
	for (int i = count0+count1-1; i >= 0; --i)
	{
		if(a01>=count0)
		{
			output[i]='1';
			count1--;
			a01-=count0;
		}
		else
			count0--;
	}
	if(count1>0)
	{
		printf("Impossible\n");
		return 0;
	}
	for (int i = 0; i < stringlength; ++i)
	{
		if(output[i]!='1')
			output[i]='0';
	}
	printf("%s\n",output);

}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 0, r = x;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    if (a == 0) {
        ans = solve(0, calc(d));
        if (ans == "Impossible")
            ans = solve(1, calc(d));
    }
    else
        ans = solve(calc(a), calc(d));
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 1, r = INF;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    if (a == 0) {
        ans = solve(0, calc(d));
        if (ans == "Impossible")
            ans = solve(1, calc(d));
    }
    else
        ans = solve(calc(a), calc(d));
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(ll x) {
    ll l = 1, r = 1ll * INF;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
    return -1;
}

string solve(int c0, int c1) {
    //cerr << c0 << ' ' << c1 << endl;
    if (b + c != 1ll * c0 * c1 || c0 + c1 > 1000000 || c1 == -1 || c0 == -1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c1.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible" && ans != "") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << "Impossible" << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 1, r = INF;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c0.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    ll l = 1, r = 1ll * INF * 10;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    //cerr << c0 << ' ' << c1 << endl;
    if (b + c != 1ll * c0 * c1 || c0 + c1 > 1000000)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c1.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible" && ans != "") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << "Impossible" << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 1, r = INF;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    //cerr << c0 << ' ' << c1 << endl;
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c1.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible" && ans != "") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    ll l = 1, r = INFll;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    //cerr << c0 << ' ' << c1 << endl;
    if (b + c != 1ll * c0 * c1 || c0 + c1 > 1000000)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c1.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible" && ans != "") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << "Impossible" << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 1, r = INF;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    vector <int> c0, c1;
    if (a == 0)
        c0.pb(0), c0.pb(1);
    else
        c0.pb(calc(a));
    if (d == 0)
        c1.pb(0), c0.pb(1);
    else
        c1.pb(calc(d));
    for (int i = 0; i < c0.size(); i++)
        for (int j = 0; j < c1.size(); j++) {
            ans = solve(c0[i], c1[j]);
            if (ans != "Impossible" && ans != "") {
                cout << ans << endl;
                return 0;
            }
        }
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <stack>
#include <iterator>
#include <cctype>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;
typedef istream_iterator <int> iii;

const int INF = int(1e9);
const int MOD = int(1e9) + 7;
const ll N = 1000010;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};
const ld PI = 3.1415926535897932384;

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
    return out;
}

int a, b, c, d;

int calc(int x) {
    int l = 1, r = x;
    while (l <= r) {
        ll mid = (l + r) / 2;
        ll value = mid * (mid - 1) / 2;
        if (value == x)
            return mid;
        if (value < x)
            l = mid + 1;
        else
            r = mid - 1;
    }
}

string solve(int c0, int c1) {
    if (b + c != 1ll * c0 * c1)
        return "Impossible";
    string s = "";
    for (int i = 0; i < c0; i++)
        s += '0';
    for (int i = 0; i < c1; i++)
        s += '1';
    ll cur = c0 * c1;
    if (c0 == 0)
        return s;
    int pos = c0 - 1;
    int to = s.size() - 1;
    while (pos >= 0 && cur - b >= c1) {
        swap(s[pos], s[to]);
        pos--, to--;
        cur -= c1;
    }
    if (pos >= 0 && cur - b < c1)
        swap(s[pos], s[pos + cur - b]);
    return s;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> a >> b >> c >> d;
    string ans = "";
    if (a == 0) {
        ans = solve(0, calc(d));
        if (ans == "Impossible")
            ans = solve(1, calc(d));
    }
    else
        ans = solve(calc(a), calc(d));
    cout << ans << endl;
    cerr << fixed << setprecision(0) << "TIME = " << clock() / (ld)CLOCKS_PER_SEC * 1000 << "\n";
    return 0;
}


#include <cstring>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
typedef pair<ll,ll> pt;
map<pt, string> dp;
ll a00, a01, a10, a11;

string getRes(ll ones, ll zeros, ll maxOnes, ll maxZeros, ll curr01, ll curr10){
    pt key = make_pair(ones, zeros);
    if(dp.find(key) != dp.end()){
        //return dp[key];
    }
    string res = "err";
    if(ones == maxOnes && zeros == maxZeros && curr01 == a01 && curr10 == a10){
        res = "";
    } else {
        if(ones < maxOnes){
            ll next01 = curr01 + zeros;
            ll next10 = curr10;

            if(next01 <= a01){
                string currRes = getRes(ones+1, zeros, maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "1" + currRes;
                }
            }
        }
        if(zeros < maxZeros && res[0] == 'e'){
            ll next01 = curr01;
            ll next10 = curr10 + ones;
            if(next10 <= a10){
                string currRes = getRes(ones,zeros+1,maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "0" + currRes;

                }
            }
        }
    }
    return dp[key] = res;
}

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones = (1+rt) / 2;
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros = (1+rt) / 2;
    if(ones + zeros > LIM || ones+zeros == 0){
        cout<<impossible;
        return 0;
    }
    string res = getRes(0,0,ones,zeros,0,0);
    if(res[0] == 'e'){
        cout<<impossible;
    } else {
        cout<<res;
    }
    return 0;
}


#include <cstring>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
typedef pair<ll,ll> pt;
map<pt, string> dp;
ll a00, a01, a10, a11;

string getRes(ll ones, ll zeros, ll maxOnes, ll maxZeros, ll curr01, ll curr10){
    pt key = make_pair(ones, zeros);
    if(dp.find(key) != dp.end()){
        return dp[key];
    }
    string res = "err";
    if(ones == maxOnes && zeros == maxZeros && curr01 == a01 && curr10 == a10){
        res = "";
    } else {
        if(ones < maxOnes){
            ll next01 = curr01 + zeros;
            ll next10 = curr10;

            if(next01 <= a01){
                string currRes = getRes(ones+1, zeros, maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "1" + currRes;
                }
            }
        }
        if(zeros < maxZeros && res[0] == 'e'){
            ll next01 = curr01;
            ll next10 = curr10 + ones;
            if(next10 <= a10){
                string currRes = getRes(ones,zeros+1,maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "0" + currRes;

                }
            }
        }
    }
    return dp[key] = res;
}

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones = (1+rt) / 2;
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros = (1+rt) / 2;
    if(ones + zeros > LIM){
        cout<<impossible;
        return 0;
    }
    string res = getRes(0,0,ones,zeros,0,0);
    if(res[0] == 'e'){
        cout<<impossible;
    } else {
        cout<<res;
    }
    return 0;
}


#include <cstring>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
ll a00, a01, a10, a11;

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    if(a00 == 0 && a01 == 0 && a10 == 0 && a11 == 0){
        cout<<"0";
        return 0;
    }
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones = (1+rt) / 2;
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros = (1+rt) / 2;
    if(ones + zeros > LIM){
        cout<<impossible;
        return 0;
    }
    char s[LIM];
    ll curr01 = 0;
    ll curr10 = 0;
    ll usedOnes = 0;
    ll usedZeros = 0;
    for(int i = 0;i<zeros+ones;++i){
        // add zero
        if(usedZeros < zeros && a01 >= curr01 + ones - usedOnes){
            s[i] = '0';
            curr01 += ones-usedOnes;
            usedZeros++;
        } else if(usedOnes < ones && a10 >= curr10 + zeros-usedZeros){
            // add one;
            s[i] = '1';
            curr10 += zeros-usedZeros;
            usedOnes++;
        } else {
            cout<<impossible;
            return 0;
        }

    }
    if(curr01 != a01 || curr10 != a10){
        cout<<impossible;
        return 0;
    }
    s[zeros+ones] = '\0';
    cout<<s;
    return 0;
}


#include <cstring>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
typedef pair<ll,ll> pt;
map<pt, string> dp;
ll a00, a01, a10, a11;

string getRes(ll ones, ll zeros, ll maxOnes, ll maxZeros, ll curr01, ll curr10){
    pt key = make_pair(ones, zeros);
    if(dp.find(key) != dp.end()){
        //return dp[key];
    }
    string res = "err";
    if(ones == maxOnes && zeros == maxZeros && curr01 == a01 && curr10 == a10){
        res = "";
    } else {
        if(ones < maxOnes){
            ll next01 = curr01 + zeros;
            ll next10 = curr10;

            if(next01 <= a01){
                string currRes = getRes(ones+1, zeros, maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "1" + currRes;
                }
            }
        }
        if(zeros < maxZeros && res[0] == 'e'){
            ll next01 = curr01;
            ll next10 = curr10 + ones;
            if(next10 <= a10){
                string currRes = getRes(ones,zeros+1,maxOnes,maxZeros, next01, next10);
                if(currRes.size() == 0 || currRes[0] != 'e'){
                    res = "0" + currRes;

                }
            }
        }
    }
    return dp[key] = res;
}

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    if(a00 == 0 && a01 == 0 && a10 == 0 && a11 == 0){
        cout<<"0";
        return 0;
    }
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones = (1+rt) / 2;
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros = (1+rt) / 2;
    if(ones + zeros > LIM){
        cout<<impossible;
        return 0;
    }
    string res = getRes(0,0,ones,zeros,0,0);
    if(res[0] == 'e'){
        cout<<impossible;
    } else {
        cout<<res;
    }
    return 0;
}


#include <cstring>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
ll a00, a01, a10, a11;

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    if(a00 == 0 && a01 == 0 && a10 == 0 && a11 == 0){
        cout<<"0";
        return 0;
    }
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones = (1+rt) / 2;
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros = (1+rt) / 2;
    if(ones + zeros > LIM){
        cout<<impossible;
        return 0;
    }
    char s[LIM];
    ll curr01 = 0;
    ll curr10 = 0;
    ll usedOnes = 0;
    ll usedZeros = 0;
    for(int i = 0;i<zeros+ones;++i){
        // add zero
        if(a01 >= curr01 + ones - usedOnes){
            s[i] = '0';
            curr01 += ones-usedOnes;
            usedZeros++;
        } else if(a10 >= curr10 + zeros-usedZeros){
            // add one;
            s[i] = '1';
            curr10 += zeros-usedZeros;
            usedOnes++;
        } else {
            cout<<impossible;
            return 0;
        }

    }
    s[zeros+ones] = '\0';
    cout<<s;
    return 0;
}


#include <cstring>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

typedef long long ll;
const ll LIM = 1000000;
ll a00, a01, a10, a11;

int main(){
    char* impossible = "Impossible";
    cin>>a00>>a01>>a10>>a11;
    if(a00 == 0 && a01 == 0 && a10 == 0 && a11 == 0){
        cout<<"0";
        return 0;
    }
    // a11
    ll d = 1 + 4*2*a11;
    ll rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll ones[2] = {(1+rt) / 2, (1-rt) / 2};
    // a00
    d = 1 + 4*2*a00;
    rt = sqrt(d);
    if(rt*rt != d || rt % 2 == 0){
        cout<<impossible;
        return 0;
    }
    ll zeros[2] = {(1+rt) / 2, (1-rt) / 2};
    for(int k = 0;k<2;++k){
        for(int t = 0;t<2;++t){
            if(ones[t] + zeros[k] > LIM || ones[t] < 0 || zeros[k] < 0){
                continue;
            }
            char s[LIM];
            ll curr01 = 0;
            ll curr10 = 0;
            ll usedOnes = 0;
            ll usedZeros = 0;
            bool valid = true;
            for(int i = 0;i<zeros[k]+ones[t];++i){
                // add zero
                if(usedZeros < zeros[k] && a01 >= curr01 + ones[t] - usedOnes){
                    s[i] = '0';
                    curr01 += ones[t]-usedOnes;
                    usedZeros++;
                } else if(usedOnes < ones[t] && a10 >= curr10 + zeros[k]-usedZeros){
                    // add one;
                    s[i] = '1';
                    curr10 += zeros[k]-usedZeros;
                    usedOnes++;
                } else {
                    valid = false;
                    break;
                }

            }
            if(curr01 != a01 || curr10 != a10 || !valid){
                continue;
            }
            s[zeros[k]+ones[t]] = '\0';
            cout<<s;
            return 0;
        }
    }
    cout<<impossible;
    return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <assert.h>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
#include <complex>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
using namespace std;

#define int64 long long
#define mp make_pair

#ifdef _DEBUG
	const int N = 5010;
#else
	const int N = 5010;
#endif

int n, m, k, a[N][N], rc[N], rt[N], cc[N], ct[N];

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++)
	{
		int type;
		scanf("%d", &type);
		if (type == 1)
		{
			int r, x;
			scanf("%d%d", &r, &x);
			rc[r] = x;
			rt[r] = i;
		}
		else
		{
			int c, x;
			scanf("%d%d", &c, &x);
			cc[c] = x;
			ct[c] = i;
		}
	}
	for (int i = 1; i <= n; i++)
		if (rc[i] != 0)
		{
			for (int j = 1; j <= m; j++) a[i][j] = rc[i];
		}
	for (int i = 1; i <= m; i++)
		if (cc[i] != 0)
		{
			for (int j = 1; j <= n; j++)
				if (rt[j] == 0 || rt[j] < ct[i]) a[j][i] = cc[i];
		}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++) printf("%d ", a[i][j]);
		printf("\n");
	}
    return 0;
}


#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <assert.h>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
#include <complex>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
using namespace std;

#define int64 long long
#define mp make_pair

#ifdef _DEBUG
	const int N = 5010;
#else
	const int N = 5010;
#endif

int n, m, k, a[N][N], rc[N], rt[N], cc[N], ct[N];

int main()
{
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i++)
	{
		int type;
		scanf("%d", &type);
		if (type == 1)
		{
			int r, x;
			scanf("%d%d", &r, &x);
			rc[r] = x;
			rt[r] = i;
		}
		else
		{
			int c, x;
			scanf("%d%d", &c, &x);
			cc[c] = x;
			ct[c] = i;
		}
	}
	for (int i = 1; i <= n; i++)
		if (rc[i] != 0)
		{
			for (int j = 1; j <= m; j++) a[i][j] = rc[i];
		}
	for (int i = 1; i <= m; i++)
		if (cc[i] != 0)
		{
			for (int j = 1; j <= n; j++)
				if (rt[j] == 0 || rt[j] < ct[i]) a[j][i] = cc[i];
		}
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++) printf("%d ", a[i][j]);
		printf("\n");
	}
    return 0;
}


#include <stdio.h>
int a[5005][5005];
int main(){
    int n, m, k, flg, c, num;
    scanf("%d%d%d", &n, &m, &k);
    while(k--){
        scanf("%d%d%d", &flg, &c, &num);
        if(flg == 1){
            for(int i = 1; i <= m; i++)
                a[c][i] = num;
        }
        else {
            for(int i = 1; i <= n; i++)
                a[i][c] = num;
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++)
            printf("%d ", a[i][j]);
        printf("\n");
    }
}


#include <stdio.h>
#include <string.h>
int flg[100005];
int c[100005];
int num[100005];
int flag[200005];
int main(){
    int n, m, k, y;
    scanf("%d%d%d", &n, &m, &k);
    memset(flag, -1, sizeof(flag));
    for(int i = 1; i <= k; i++)
        scanf("%d%d%d", &flg[i], &c[i], &num[i]);
    for(int i = k; i > 0; i--){
        if(flg[i] == 1) y = c[i];
        else y = c[i] + n;
        if(flag[y] == -1) flag[y] = i;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(flag[i] == -1 && flag[j + n] == -1) printf("0 ");
            else if(flag[i] == -1 && flag[j + n] != -1) printf("%d ", num[flag[j + n]]);
			else if(flag[i] != -1 && flag[j + n] == -1) printf("%d ", num[flag[i]]);
			else{
				if(flag[i] > flag[j + n]) printf("%d ", num[flag[i]]);
				else printf("%d ", num[flag[j + n]]);
			}
		}
        printf("\n");
    }
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <limits.h>

#include <string.h>

#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>

#include <unordered_map>
#include <unordered_set>

#include <stdio.h>

#define llong long long
#define ull unsigned long long

#define ldouble long double

#define uchar unsigned char

#define cast(TYPE,VAL) ((TYPE)(VAL))

#define mp make_pair

#define mllc(LPT,TYPE,SIZE) LPT = (TYPE*) malloc( sizeof(TYPE) * (SIZE) );
#define rllc(LPT,TYPE,SIZE) LPT = (TYPE*) realloc( LPT, sizeof(TYPE) * (SIZE) );

#define max(a,b) (((a)<(b))?(b):(a))
#define min(a,b) (((a)<(b))?(a):(b))

#define sqr(a) ((a)*(a))
#define distsqr(x1,y1,x2,y2) ((sqr(x2-x1))+(sqr(y2-y1)))

#define vmid(L,R) ((L)+(((R)-(L))/2))
#define vmidl(L,R) ((L)+(((R)-(L))/2.0))

const ldouble ACOSPI = (acosl(-1.0));

#define done return 0

using namespace std;

//#define TEST
//#define SPECIFIC_FILE_NAME ""

#ifdef SPECIFIC_FILE_NAME
#define SPEC_INP_NAME SPECIFIC_FILE_NAME##".in"
#define SPEC_OUT_NAME SPECIFIC_FILE_NAME##".out"
#endif

#define dist(x,y) (sqrtl(cast(ldouble,sqr(x))+cast(ldouble,sqr(y))))

struct state
{
	int a;
	int p;
	int i;
};

bool scmp( state & a, state & b )
{
	return( a.p > b.p );
}

int main()
{
#ifndef ONLINE_JUDGE
#ifndef SPECIFIC_FILE_NAME
	freopen( "input.txt", "rb", stdin );
	freopen( "output.txt", "wb", stdout );
#else
	freopen( SPEC_INP_NAME, "rb", stdin );
	freopen( SPEC_OUT_NAME, "wb", stdout );
#endif
#endif
#ifdef TEST
#endif

	int n = 0, m = 0, k = 0, iter = 0;

	int type = 0, index = 0, color = 0;

	int ** field = NULL;
	state * r = NULL;
	state * c = NULL;

	int i = 0, j = 0;

	int carry = 0; // carry does not mean the same thing as "carry flag" or "carry digit"

	scanf( "%d %d %d", &n, &m, &k );

	mllc(field,int*,n);
	for( i = 0; i < n; i++ )
		mllc(field[i],int,m);

	mllc(r,state,n);
	mllc(c,state,m);

	for( i = 0; i < n; i++ )
	{
		r[i].a = 0;
		r[i].p = -1;
		r[i].i = i;
		for( j = 0; j < m; j++ )
			field[i][j] = 0;
	}

	for( i = 0; i < m; i++ )
	{
		c[i].a = 0;
		c[i].p = -1;
		c[i].i = i;
	}

	for( i = 0; i < k; i++ )
	{
		scanf( "%d %d %d", &type, &index, &color );
		if( type == 1 )
		{
			r[index-1].a = color;
			r[index-1].p = i;
		}
		else
		{
			c[index-1].a = color;
			c[index-1].p = i;
		}
	}

	sort(r,r+n,&scmp);
	sort(c,c+m,&scmp);

	i = 0;
	j = 0;

	carry = ( ( r[0].p > c[0].p ) ? 0 : 1 );

	while( r[i].p != -1 || c[j].p != -1 )
	{
		if( carry == 0 )
		{
			for( iter = 0; iter < m; iter++ )
				if( field[r[i].i][iter] == 0 )
					field[r[i].i][iter] = r[i].a;

			i++;
		}
		else
		{
			for( iter = 0; iter < n; iter++ )
				if( field[iter][c[j].i] == 0 )
					field[iter][c[j].i] = c[j].a;

			j++;
		}

		carry = ( ( r[i].p > c[j].p ) ? 0 : 1 );
	}

	for( i = 0; i < n; i++ )
	{
		for( j = 0; j < m; j++ )
			printf( "%d ", field[i][j] );

		printf( "\n" );
	}

	done;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <limits.h>

#include <string.h>

#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>

#include <unordered_map>
#include <unordered_set>

#include <stdio.h>

#define llong long long
#define ull unsigned long long

#define ldouble long double

#define uchar unsigned char

#define cast(TYPE,VAL) ((TYPE)(VAL))

#define mp make_pair

#define mllc(LPT,TYPE,SIZE) LPT = (TYPE*) malloc( sizeof(TYPE) * (SIZE) );
#define rllc(LPT,TYPE,SIZE) LPT = (TYPE*) realloc( LPT, sizeof(TYPE) * (SIZE) );

#define max(a,b) (((a)<(b))?(b):(a))
#define min(a,b) (((a)<(b))?(a):(b))

#define sqr(a) ((a)*(a))
#define distsqr(x1,y1,x2,y2) ((sqr(x2-x1))+(sqr(y2-y1)))

#define vmid(L,R) ((L)+(((R)-(L))/2))
#define vmidl(L,R) ((L)+(((R)-(L))/2.0))

const ldouble ACOSPI = (acosl(-1.0));

#define done return 0

using namespace std;

//#define TEST
//#define SPECIFIC_FILE_NAME ""

#ifdef SPECIFIC_FILE_NAME
#define SPEC_INP_NAME SPECIFIC_FILE_NAME##".in"
#define SPEC_OUT_NAME SPECIFIC_FILE_NAME##".out"
#endif

#define dist(x,y) (sqrtl(cast(ldouble,sqr(x))+cast(ldouble,sqr(y))))

struct state
{
	int a;
	int p;
	int i;
};

bool scmp( state & a, state & b )
{
	return( a.p > b.p );
}

int main()
{
#ifndef ONLINE_JUDGE
#ifndef SPECIFIC_FILE_NAME
	freopen( "input.txt", "rb", stdin );
	freopen( "output.txt", "wb", stdout );
#else
	freopen( SPEC_INP_NAME, "rb", stdin );
	freopen( SPEC_OUT_NAME, "wb", stdout );
#endif
#endif
#ifdef TEST
#endif

	int n = 0, m = 0, k = 0, iter = 0;

	int type = 0, index = 0, color = 0;

	int ** field = NULL;
	state * r = NULL;
	state * c = NULL;

	int i = 0, j = 0;

	int carry = 0; // carry does not mean the same thing as "carry flag" or "carry digit"

	scanf( "%d %d %d", &n, &m, &k );

	mllc(field,int*,n);
	for( i = 0; i < n; i++ )
		mllc(field[i],int,m);

	mllc(r,state,n+1);
	mllc(c,state,m+1);

	for( i = 0; i < n; i++ )
	{
		r[i].a = 0;
		r[i].p = -1;
		r[i].i = i;
		for( j = 0; j < m; j++ )
			field[i][j] = 0;
	}

	for( i = 0; i < m; i++ )
	{
		c[i].a = 0;
		c[i].p = -1;
		c[i].i = i;
	}

	r[n].a = 0;
	r[n].p = -1;
	r[n].i = n;

	c[m].a = 0;
	c[m].p = -1;
	c[m].i = n;

	for( i = 0; i < k; i++ )
	{
		scanf( "%d %d %d", &type, &index, &color );
		if( type == 1 )
		{
			r[index-1].a = color;
			r[index-1].p = i;
		}
		else
		{
			c[index-1].a = color;
			c[index-1].p = i;
		}
	}

	sort(r,r+n,&scmp);
	sort(c,c+m,&scmp);

	i = 0;
	j = 0;

	carry = ( ( r[0].p > c[0].p ) ? 0 : 1 );

	while( r[i].p != -1 || c[j].p != -1 )
	{
		if( carry == 0 )
		{
			for( iter = 0; iter < m; iter++ )
				if( field[r[i].i][iter] == 0 )
					field[r[i].i][iter] = r[i].a;

			i++;
		}
		else
		{
			for( iter = 0; iter < n; iter++ )
				if( field[iter][c[j].i] == 0 )
					field[iter][c[j].i] = c[j].a;

			j++;
		}

		carry = ( ( r[i].p > c[j].p ) ? 0 : 1 );
	}

	for( i = 0; i < n; i++ )
	{
		for( j = 0; j < m; j++ )
			printf( "%d ", field[i][j] );

		printf( "\n" );
	}

	done;
}


#define _CRT_SECURE_NO_WARNINGS
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<string>
#include<vector>
using namespace std;
typedef long long LL;
typedef struct Point{
	int x, y;
	Point(int x = 0, int y = 0) :x(x), y(y){}
	friend bool operator < (Point a, Point b){
		return a.x < b.x;
	}
}Point;
typedef struct Query{
	int md, x, a;
}Query;
Query q[100005];
class Comp
{
public:
	bool operator()(const Point a, const Point b)
	{
		return a.y < b.y;
	}
};
int n, m, k;
bool vr[5005], vc[5005];
multiset<Point, Comp> S2;//按y排序
multiset<Point> S1;//按x排序
multiset<Point> ::iterator it;//按x排序
int mp[5005][5005];
int main(){
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			S1.insert(Point(i, j));
			S2.insert(Point(i, j));
		}
	}
	for (int i = 0; i < k; i++){
		scanf("%d%d%d", &q[i].md, &q[i].x, &q[i].a);
	}
	for (int i = k - 1; i >= 0; i--){
		if (q[i].md == 1){
			while (!S1.empty()){
				it = S1.lower_bound(Point(q[i].x));
				if (it == S1.end() || it->x != q[i].x) break;
				if (mp[it->x][it->y]){
					S1.erase(it);
					continue;
				}
				mp[it->x][it->y] = q[i].a;
				S1.erase(it);
			}
		}
		else{
			while (!S2.empty()){
				it = S2.lower_bound(Point(0, q[i].x));
				if (it == S2.end() || it -> y != q[i].x) break;
				if (mp[it->x][it->y]){
					S2.erase(it);
					continue;
				}
				mp[it->x][it->y] = q[i].a;
				S2.erase(it);
			}
		}
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			printf("%d ", mp[i][j]);
		}
		printf("\n");
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<string>
#include<vector>
using namespace std;
typedef long long LL;
typedef struct Point{
	int x, y;
	Point(int x = 0, int y = 0) :x(x), y(y){}
	friend bool operator < (Point a, Point b){
		return a.x < b.x;
	}
}Point;
typedef struct Query{
	int md, x, a;
}Query;
Query q[100005];
class Comp
{
public:
	bool operator()(const Point a, const Point b)
	{
		return a.y < b.y;
	}
};
int n, m, k;
bool vr[5005], vc[5005];
multiset<Point, Comp> S2;//按y排序
multiset<Point> S1;//按x排序
multiset<Point> ::iterator it;//按x排序
multiset<Point, Comp> ::iterator it2;//按x排序

int mp[5005][5005];
int main(){
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			S1.insert(Point(i, j));
			S2.insert(Point(i, j));
		}
	}
	for (int i = 0; i < k; i++){
		scanf("%d%d%d", &q[i].md, &q[i].x, &q[i].a);
	}
	for (int i = k - 1; i >= 0; i--){
		if (q[i].md == 1){
			while (!S1.empty()){
				it = S1.lower_bound(Point(q[i].x));
				if (it == S1.end() || it->x != q[i].x) break;
				if (mp[it->x][it->y]){
					S1.erase(it);
					continue;
				}
				mp[it->x][it->y] = q[i].a;
				S1.erase(it);
			}
		}
		else{
			while (!S2.empty()){
				it2 = S2.lower_bound(Point(0, q[i].x));
				if (it2 == S2.end() || it2 -> y != q[i].x) break;
				if (mp[it2->x][it2->y]){
					S2.erase(it2);
					continue;
				}
				mp[it2->x][it2->y] = q[i].a;
				S2.erase(it2);
			}
		}
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			printf("%d ", mp[i][j]);
		}
		printf("\n");
	}
	return 0;
}


#include <iostream>
using namespace std;

int n, m, k, time_r[6000], time_c[6000], a[100000];

int main() {
	cin >> n >> m >> k;
	for (int i = 1; i <= k; ++i) {
		int mode, ind;
		cin >> mode >> ind >> a[i];
		if (mode == 1) time_r[ind] = i;
		else time_c[ind] = i;
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			cout << a[max(time_r[i], time_c[j])] << " ";
		cout << endl;
	}

	cin >> n;
	return 0;
}


#include <iostream>
using namespace std;

int n, m, k, time_r[6000], time_c[6000], a[100003];

int main() {
	cin >> n >> m >> k;
	for (int i = 1; i <= k; ++i) {
		int mode, ind;
		cin >> mode >> ind >> a[i];
		if (mode == 1) time_r[ind] = i;
		else time_c[ind] = i;
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			cout << a[max(time_r[i], time_c[j])] << " ";
		cout << endl;
	}

	cin >> n;
	return 0;
}


#include <iostream>
using namespace std;

int n, m, k, time_r[6000], time_c[6000], a[100000];

int main() {
	cin >> n >> m >> k;
	for (int i = 0; i < k; ++i) {
		int mode, ind;
		cin >> mode >> ind >> a[i];
		if (mode == 1) time_r[ind] = i;
		else time_c[ind] = i;
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			cout << a[max(time_r[i], time_c[j])] << " ";
		cout << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
//#include "stdafx.h"
using namespace std;
const int N = 10101;
int n, m, k;
int A1[N][2], B1[N][2];

int main()
{
	int F;
	scanf("%d%d%d", &n, &m, &F);
	for (int i = 1; i <= F; i++)
	{
		int t, x, c;
		scanf("%d%d%d", &t, &x, &c);
		x--;
		if (t == 1){
			A1[x][0] = c;
			A1[x][1] = i;}
		else{
			B1[x][0] = c;
			B1[x][1] = i;}}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (A1[i][1] > B1[j][1])
				printf("%d ", A1[i][0]);
			else
				printf("%d ", B1[j][0]);}
		printf("\n");}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include "stdafx.h"
using namespace std;
const int N = 10101;
int n, m, k;
int A1[N][2], B1[N][2];

int main()
{
	int F;
	scanf("%d%d%d", &n, &m, &F);
	for (int i = 1; i <= F; i++)
	{
		int t, x, c;
		scanf("%d%d%d", &t, &x, &c);
		x--;
		if (t == 1){
			A1[x][0] = c;
			A1[x][1] = i;}
		else{
			B1[x][0] = c;
			B1[x][1] = i;}}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			if (A1[i][1] > B1[j][1])
				printf("%d ", A1[i][0]);
			else
				printf("%d ", B1[j][0]);}
		printf("\n");}
	return 0;
}


#include <stdio.h>

const int maxn = 5005;
const int maxm = 1e5 + 5;

int box[maxn][maxn];
bool boxf[maxn][maxn];
bool boxr[maxn];
bool boxc[maxn];

struct Node
{
	int id, rc, ai;
	//Node(int a, int b, int c): id(a), rc(b), ai(c){}
}node[maxm];

int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < k; i++)
	{
		scanf("%d%d%d", &node[i].id, &node[i].rc, &node[i].ai);
	}

	for (int i = k - 1; i >= 0 ; i--)
	{
		if (node[i].id == 1)
		{
			if (boxr[node[i].id]) continue;
			for (int j = 1; j <= m; j++)
			{
				if (boxf[node[i].rc][j]) continue;
				box[node[i].rc][j] = node[i].ai;
			}
		}
		else
		{
			if (boxc[node[i].id]) continue;
			for (int j = 1; j <= n; j++)
			{
				if (boxf[j][node[i].rc]) continue;
				box[j][node[i].rc] = node[i].ai;
			}
		}
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
		{
			if (j != m) printf("%d ", box[i][j]);
			else printf("%d\n", box[i][j]);
		}
	return 0;
}


#include <stdio.h>

const int maxn = 5005;

int box[maxn][maxn];

int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	while(k--)
	{
		int id, rc, ai;
		scanf("%d%d%d", &id, &rc, &ai);
		if (1 == id)
		{
			for (int i = 1; i <= m; i++)
			{
				box[rc][i] = ai;
			}
		}
		else
		{
			for (int i = 1; i <= n; i++)
			{
				box[i][rc] = ai;
			}
		}
	}

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= m; j++)
		{
			if (j != m) printf("%d ", box[i][j]);
			else printf("%d\n", box[i][j]);
		}
	}
	return 0;
}


#include <stdio.h>

const int maxn = 5005;
const int maxm = 1e5 + 5;

int box[maxn][maxn];
bool boxf[maxn][maxn];
bool boxr[maxn];
bool boxc[maxn];

struct Node
{
	int id, rc, ai;
	//Node(int a, int b, int c): id(a), rc(b), ai(c){}
}node[maxm];

int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < k; i++)
	{
		scanf("%d%d%d", &node[i].id, &node[i].rc, &node[i].ai);
	}

	for (int i = k - 1; i >= 0 ; i--)
	{
		if (node[i].id == 1)
		{
			if (boxr[node[i].rc]) continue;
			for (int j = 1; j <= m; j++)
			{
				if (!boxf[node[i].rc][j])
				{
					boxf[node[i].rc][j] = true;
					box[node[i].rc][j] = node[i].ai;
				}
			}
			boxr[node[i].rc] = true;
		}
		else
		{
			if (boxc[node[i].rc]) continue;
			for (int j = 1; j <= n; j++)
			{
				if (!boxf[j][node[i].rc])
				{
					boxf[j][node[i].rc] = true;
					box[j][node[i].rc] = node[i].ai;
				}
			}
			boxc[node[i].rc] = true;
		}
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
		{
			if (j != m) printf("%d ", box[i][j]);
			else printf("%d\n", box[i][j]);
		}
	return 0;
}


#include <stdio.h>

const int maxn = 5005;
const int maxm = 1e5 + 5;

int box[maxn][maxn];
bool boxf[maxn][maxn];
bool boxr[maxn];
bool boxc[maxn];

struct Node
{
	int id, rc, ai;
	//Node(int a, int b, int c): id(a), rc(b), ai(c){}
}node[maxm];

int main()
{
	int n, m, k;
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 0; i < k; i++)
	{
		scanf("%d%d%d", &node[i].id, &node[i].rc, &node[i].ai);
	}

	for (int i = k - 1; i >= 0 ; i--)
	{
		if (node[i].id == 1)
		{
			if (boxr[node[i].id]) continue;
			int cnt = 0;
			for (int j = 1; j <= m; j++)
			{
				if (boxf[node[i].rc][j]) continue;
				boxf[node[i].rc][j] = true;
				box[node[i].rc][j] = node[i].ai;
				if (++cnt >= n) boxc[node[i].id] = true;

			}
		}
		else
		{
			if (boxc[node[i].id]) continue;
			int cnt = 0;
			for (int j = 1; j <= n; j++)
			{
				if (boxf[j][node[i].rc]) continue;
				boxf[j][node[i].rc] = true;
				box[j][node[i].rc] = node[i].ai;
				cnt ++;
				if (cnt >= n) boxc[node[i].id] = true;
			}
		}
	}

	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
		{
			if (j != m) printf("%d ", box[i][j]);
			else printf("%d\n", box[i][j]);
		}
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
const int maxn = 5000 + 5;
int n, m, k;
int atlas[maxn][maxn];

void init(){
     for(int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            atlas[i][j] = 0;
        }
     }
}

int main(){
	while (scanf("%d%d%d", &n, &m, &k) == 3){
        init();
        int a, b, c;
        for (int i = 0; i < k; i++){
            scanf("%d%d%d", &a, &b, &c);
            if (a == 1){//表示行
                for (int i = 0; i < m; i++){
                    atlas[b - 1][i] = c;
                }
            }
            else {
                for (int i = 0; i < n; i++){
                    atlas[i][b - 1] = c;
                }
            }
        }
        for (int i = 0; i < n; i++){
            for (int j = 0; j < m; j++){
                printf("%d%c", atlas[i][j], j == m-1 ? '\n' : ' ');
            }
        }
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;
const int maxn = 5000 + 50;
int n, m, k;
struct point{
    int tmp;
    int cnt;
}x[maxn], y[maxn];

void init(){
   memset(x, 0, sizeof(x));
   memset(y, 0, sizeof(y));
   int a, b, c;
   for (int i = 1; i <= k; i++){
     scanf("%d%d%d", &a, &b, &c);
     if (a == 1) {
        x[b - 1].tmp = i;
        x[b - 1].cnt = c;
     }
     else if (a == 2){
        y[b - 1].tmp = i;
        y[b - 1].cnt = c;
     }
   }
}

void prin(){
     for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            if (y[j].tmp > x[i].tmp){
                printf("%d%c", y[j].cnt, j == m-1 ? '\n':' ');
            }
            else if (y[j].tmp < x[i].tmp){
                printf("%d%c", x[i].cnt, j == m-1 ? '\n' : ' ');
            }
            else printf("%d%c", 0, j == m-1 ? '\n' : ' ');
        }
     }
}

int main(){
    while (scanf("%d%d%d", &n, &m, &k) == 3){
        init();
        prin();
    }
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
const int maxn = 5000 + 5;
int n, m, k;
int atlas[maxn][maxn];
struct pt{
    int cnt, val;
    int tmp;
};
pt x[maxn], y[maxn];

void init(){
     memset(x, 0, sizeof(x));
     memset(y, 0, sizeof(y));
     for(int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            atlas[i][j] = 0;
        }
     }
}

int main(){
	while (scanf("%d%d%d", &n, &m, &k) == 3){
        init();
        int a, b, c;
        for (int i = 0; i < k; i++){
            scanf("%d%d%d", &a, &b, &c);
            if (a == 1) {x[b - 1].cnt++; x[b - 1].val = c; x[b - 1].tmp = i;}
            else {y[b - 1].cnt++; y[b - 1].val = c; y[b - 1].tmp = i;}
        }
        for (int i = 0; i < n; i++){
            for (int j = 0; j < m; j++){
                if (y[j].cnt > x[i].cnt){
                    printf("%d%c", y[j].val, j == m-1 ? '\n' : ' ');
                }
                else if (y[j].cnt < x[i].cnt){
                    printf("%d%c", x[i].val, j == m-1 ? '\n' :' ');
                }
                else if (y[j].tmp > x[i].tmp){
                    printf("%d%c", y[j].val, j == m-1 ? '\n' : ' ');
                }
                else {
                    printf("%d%c", x[i].val, j == m-1 ? '\n' :' ');
                }
            }
        }
	}
	return 0;
}


#pragma comment (linker, "/STACK:256000000")

#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>
#include <complex>
#include <random>
#include <bitset>

using namespace std;

typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef long double ldouble;
typedef pair<int, int> pii;
typedef pair<int64, int64> pll;
typedef pair<pii, pii> piiii;

#define pb push_back
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define rand32() (((unsigned int)(rand()) << 16) | (unsigned int)(rand()))
#define rand64() (((unsigned int64)(rand32()) << 16) | (unsigned int64)(rand32()))
#define bit(mask, b) ((mask >> b) & 1)
#define biton(mask, bit) (mask | (((unsigned int)(1)) << bit))
#define bitoff(mask, bit) (mask & (~(((unsigned int)(1)) << bit)))
#define bitputon(mask, bit) (mask |= (((unsigned int)(1)) << bit))
#define bitputoff(mask, bit) (mask &= (~(((unsigned int)(1)) << bit)))
#define FAIL() (*((int*)(0)))++
#define INF ((int)(1e9) + 1337)
#define LINF ((int64)(1e18))
#define EPS (1e-9)
#define PI (3.1415926535897932384626433832795)
#define y1 yy1
#define y0 yy0
#define j0 jj0
#define MOD 1000000007LL
#define HMOD 1234567891LL

//#define HMOD ((int64)(1e18) + 3LL)
//#ifdef _MY_DEBUG
//#define HMOD 1000000007
//#endif
#define MAX 2000000000
#define HBASE 127
const int MAXN = 5000;
int n, m, k;
pii a[MAXN];
pii b[MAXN];

void solve()
{
	scanf("%d %d %d", &n, &m, &k);
	for(int i = 0; i < k; ++i)
	{
		int t, x, c;
		scanf("%d %d %d", &t, &x, &c);
		x--;
		if (t == 1)
		{
			a[x] = pii(c, i + 1);
		}
		else
		{
			b[x] = pii(c, i + 1);
		}
	}

	for(int i = 0; i < n; ++i)
	{
		for(int j = 0; j < m; ++j)
		{
			int ans;
			if (a[i].second > b[j].second)
				ans = a[i].first;
			else
				ans = b[j].first;
			printf("%d ", ans);
		}
		printf("\n");
	}
}

int main()
{
#ifdef _MY_DEBUG
    freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#else
    //freopen(TASK ".in", "rt", stdin); freopen(TASK ".out", "wt", stdout);
#endif
    //stresstest(); return 0;
    srand(1313);
	solve();

    return 0;
}


#pragma comment (linker, "/STACK:256000000")

#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>
#include <complex>
#include <random>
#include <bitset>

using namespace std;

typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef long double ldouble;
typedef pair<int, int> pii;
typedef pair<int64, int64> pll;
typedef pair<pii, pii> piiii;

#define pb push_back
#define sq(x) ((x)*(x))
#define tmin(x,y,z) (min(min((x),(y)),(z)))
#define rand32() (((unsigned int)(rand()) << 16) | (unsigned int)(rand()))
#define rand64() (((unsigned int64)(rand32()) << 16) | (unsigned int64)(rand32()))
#define bit(mask, b) ((mask >> b) & 1)
#define biton(mask, bit) (mask | (((unsigned int)(1)) << bit))
#define bitoff(mask, bit) (mask & (~(((unsigned int)(1)) << bit)))
#define bitputon(mask, bit) (mask |= (((unsigned int)(1)) << bit))
#define bitputoff(mask, bit) (mask &= (~(((unsigned int)(1)) << bit)))
#define FAIL() (*((int*)(0)))++
#define INF ((int)(1e9) + 1337)
#define LINF ((int64)(1e18))
#define EPS (1e-9)
#define PI (3.1415926535897932384626433832795)
#define y1 yy1
#define y0 yy0
#define j0 jj0
#define MOD 1000000007LL
#define HMOD 1234567891LL

//#define HMOD ((int64)(1e18) + 3LL)
//#ifdef _MY_DEBUG
//#define HMOD 1000000007
//#endif
#define MAX 2000000000
#define HBASE 127
const int MAXN = 5000;
int n, m, k;
int a[MAXN][MAXN];

void solve()
{
	scanf("%d %d %d", &n, &m, &k);
	for(int i = 0; i < k; ++i)
	{
		int t, x, b;
		scanf("%d %d %d", &t, &x, &b);
		x--;
		if (t == 1)
		{
			for(int j = 0; j < m; ++j)
				a[x][j] = b;
		}
		else
		{
			for(int j = 0; j < n; ++j)
				a[j][x] = b;
		}
	}
	for(int i = 0; i < n; ++i)
	{
		for(int j = 0; j < m; ++j)
		{
			printf("%d ", a[i][j]);
		}
		printf("\n");
	}
}

int main()
{
#ifdef _MY_DEBUG
    freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#else
    //freopen(TASK ".in", "rt", stdin); freopen(TASK ".out", "wt", stdout);
#endif
    //stresstest(); return 0;
    srand(1313);
	solve();

    return 0;
}