function *main() {
  
  const [A, B] = (yield).split(" ").map(s => +s);
  
  // floor(X/25) = A/2 => A*25/2 <= X <= A*25/2+24
  // floor(X/10) = A => A*10 <= X <= A*10+9
  const l1 = A*25/2, r1 = l1+24;
  const l2 = B*10, r2 = l2+9;
  
  if (r1 < l2 || r2 < l1) {
    console.log(-1);
  } else {
    console.log(Math.max(l1, l2));
  }
  
}

const iter = main();
iter.next();
require("readline").createInterface({input: process.stdin}).on("line", s => iter.next(s));
