#include
using namespace std;
int main(){
int count=0;
int h1,h2;
int MaxH[3];
cin>>h1>>h2;
cin>>MaxH[0]>>MaxH[1]>>MaxH[2];
for(int i=0;i<3;i++){
if(MaxH[i]
count++;
}
if(count==0)
cout<<-1< else{ cout< } }
else{
cout< } }