#include <bits/stdc++.h>
using namespace std;
int main(){
freopen ("sequence.in","r",stdin);
freopen ("sequence.out","w",stdout);
int n,a0,b0,l0,a1,b1,l1;
scanf("%d%d%d%d%d%d%d",&n,&a0,&b0,&l0,&a1,&b1,&l1);
if (n>10){
cout<<-1<<endl;return 0;
}
int a[15]={0};
for (int i=0;i<=(1<<n)-1;i++){
for (int j=1;j<=n;j++){
if ((i>>(j-1))&1)a[j]=a[j-1];
else a[j]=a[j-1]+1;
}
bool ok=0;
for (int j=l0;j<=n;j++){
if (a[j]-a[j-l0]<a0||a[j]-a[j-l0]>b0){
ok=1;break;
}
}
for (int j=l1;j<=n;j++){
if (a[j]-a[j-l1]<l1-b1||a[j]-a[j-l1]>l1-a1){
ok=1;break;
}
}
if (ok==0){
for (int j=1;j<=n;j++){
cout<<((i>>(j-1))&1);
}return 0;
}
}
}