#include<iostream>

using namespace std;
int main(){
    int N,A,a3,bs,A1,b,a;
    bs=0;
    b=-1;
    a=0;
    A1=a3+a;
    cin>>N>>A;
    if(N==3*A+2*a+a3 && A-a3=2 || A-a3>2){
       for(bs<3){
        cout<<A<<a;
        a3=A1-2*a;
        cout<<A<<a3;
        bs=bs+1;
      }
    }
    else{
      cout<<b;
    }
}