import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(a, b) = in.readLine().split("\\s+").map(_.toInt)

    val a1 = Math.ceil(100.0 * a / 8).toInt
    val a2 = Math.ceil(100.0 * (a + 1) / 8).toInt - 1
    val b1 = 10 * b
    val b2 = 10 * b + 9

    @tailrec
    def and(a1: Int, a2: Int, b1: Int, b2: Int): Option[(Int, Int)] = {
      if (a1 > a2 || b1 > b2) {
        None
      } else if(a1 > b1) {
        and(b1, b2, a1, a2)
      } else {
        if (a2 < b1) {
          None
        } else if (a2 < b2) {
          Some((b1, a2))
        } else {
          Some((b1, b2))
        }
      }
    }

    out.println(
      and(a1, a2, b1, b2) match {
        case Some((c1, _)) => c1
        case None => -1
      }
    )
    out.flush()
  }
}
