import java.util.Scanner;

class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);

	  long A = Long.parseLong(nums[0]);
	  long Aplus = A + 1;
	  long B = Long.parseLong(nums[1]);
	  long Bplus = B + 1;

	  
	  long ansA = (A * 100) / 8;
	  if((A * 100) % 8 > 0){
	  	ansA++;
	  }
	  long ansAplus = (Aplus * 100) / 8;
	  if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  }
	  
	  
	  long ansB = B * 10;
	  long ansBplus = Bplus * 10;
	  
	  if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  }
	  
	}
} import java.util.Scanner; Scanner java.util class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);

	  long A = Long.parseLong(nums[0]);
	  long Aplus = A + 1;
	  long B = Long.parseLong(nums[1]);
	  long Bplus = B + 1;

	  
	  long ansA = (A * 100) / 8;
	  if((A * 100) % 8 > 0){
	  	ansA++;
	  }
	  long ansAplus = (Aplus * 100) / 8;
	  if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  }
	  
	  
	  long ansB = B * 10;
	  long ansBplus = Bplus * 10;
	  
	  if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  }
	  
	}
} Main public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);

	  long A = Long.parseLong(nums[0]);
	  long Aplus = A + 1;
	  long B = Long.parseLong(nums[1]);
	  long Bplus = B + 1;

	  
	  long ansA = (A * 100) / 8;
	  if((A * 100) % 8 > 0){
	  	ansA++;
	  }
	  long ansAplus = (Aplus * 100) / 8;
	  if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  }
	  
	  
	  long ansB = B * 10;
	  long ansBplus = Bplus * 10;
	  
	  if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  }
	  
	} main {
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);

	  long A = Long.parseLong(nums[0]);
	  long Aplus = A + 1;
	  long B = Long.parseLong(nums[1]);
	  long Bplus = B + 1;

	  
	  long ansA = (A * 100) / 8;
	  if((A * 100) % 8 > 0){
	  	ansA++;
	  }
	  long ansAplus = (Aplus * 100) / 8;
	  if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  }
	  
	  
	  long ansB = B * 10;
	  long ansBplus = Bplus * 10;
	  
	  if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  }
	  
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String input = scanner.nextLine(); input scanner.nextLine() scanner.nextLine scanner String nums[] = input.split(" "); nums input.split(" ") input.split input " " long A = Long.parseLong(nums[0]); A Long.parseLong(nums[0]) Long.parseLong Long nums[0] nums 0 long Aplus = A + 1; Aplus A + 1 A 1 long B = Long.parseLong(nums[1]); B Long.parseLong(nums[1]) Long.parseLong Long nums[1] nums 1 long Bplus = B + 1; Bplus B + 1 B 1 long ansA = (A * 100) / 8; ansA (A * 100) / 8 (A * 100) A 100 8 if((A * 100) % 8 > 0){
	  	ansA++;
	  } (A * 100) % 8 > 0 (A * 100) % 8 (A * 100) A 100 8 0 {
	  	ansA++;
	  } ansA++ ansA long ansAplus = (Aplus * 100) / 8; ansAplus (Aplus * 100) / 8 (Aplus * 100) Aplus 100 8 if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  } (Aplus * 100) % 8 > 0 (Aplus * 100) % 8 (Aplus * 100) Aplus 100 8 0 {
	  	ansAplus++;
	  } ansAplus++ ansAplus long ansB = B * 10; ansB B * 10 B 10 long ansBplus = Bplus * 10; ansBplus Bplus * 10 Bplus 10 if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  } ansA > ansB ansA ansB {
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  } if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		} ansA >= ansBplus ansA ansBplus {
		  System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
	      System.out.println(ansA);
		} System.out.println(ansA) System.out.println System.out System System.out ansA {
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  } if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		} ansB >= ansAplus ansB ansAplus {
		  System.out.println(-1);
		} System.out.println(-1) System.out.println System.out System System.out -1 1 {
	      System.out.println(ansB);
		} System.out.println(ansB) System.out.println System.out System System.out ansB String args[] args
import java.util.Scanner;

class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);

	  long A = Long.parseLong(nums[0]);
	  long Aplus = A + 1;
	  long B = Long.parseLong(nums[1]);
	  long Bplus = B + 1;

	  
	  long ansA = (A * 100) / 8;
	  if((A * 100) % 8 > 0){
	  	ansA++;
	  }
	  long ansAplus = (Aplus * 100) / 8;
	  if((Aplus * 100) % 8 > 0){
	  	ansAplus++;
	  }
	  
	  
	  long ansB = B * 10;
	  long ansBplus = Bplus * 10;
	  
	  if(ansA > ansB){
	    if(ansA >= ansBplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansA);
		}
	  }else{
	    if(ansB >= ansAplus){
		  System.out.println(-1);
		}else{
	      System.out.println(ansB);
		}
	  }
	  
	}
}
