program increase
  implicit none

  integer :: a, b, x, y, pr

  read(*,*) a, b

  x = 100 * a / 8
  y = 10 * b

  if (x == y) then
     pr = x
  else if (x > y) then
     pr = x
     if (pr * 10 / 100 == b) then
        pr = x
     else
        pr = -1
     end if

  else
     pr = y
     if (pr * 8 / 100 == a) then
        pr = y
     else
        pr = -1
     end if

  end if

  write(*,*) pr

end program increase

