import scala.annotation.tailrec
import scala.collection.immutable.HashSet
import scala.io.StdIn._
object Main extends App {
  import Fractional.Implicits._
  import Ordering.Implicits._
  type Time = Rational
  type Position = Rational
  type Speed = Rational
  type Index = Int

  val goal = readLong().toRational
  val n = readInt()
  val carriages: Array[Carriage] = Array.tabulate(n){ i ⇒ Carriage(i, 1.toRational / readInt().toRational)}
  val m = readInt()
  val widePosition: Array[Position] = Array.tabulate(m){ _ ⇒ readInt().toRational} :+ goal
  val memo = Array.fill(1 << n){None: Option[List[Schedule]]}
  memo(1) = Some(List(Schedule(List(CarriagePlan(carriages(0), 0.toRational)))))

  private val result = calSuspects(BitSet.fill(n))(memo)
  println(result.map(_.lastTime).min)
  def calSuspects(set: BitSet)(implicit memo: Array[Option[List[Schedule]]]): List[Schedule] = {
    memo(set.toInt) match {
      case Some(r) ⇒
        r
      case None ⇒
        memo(set.toInt) = Some((1 until n).filter(set.isOn).flatMap(i ⇒ calSuspects(set - i).flatMap(_.added(carriages(i)))).toList)
        calSuspects(set)
    }
  }
  object BitSet{
    def fill(size: Int): BitSet = BitSet((1 << size) - 1)
  }
  case class BitSet(val toInt: Int) {
    def &(that: BitSet): BitSet = BitSet(toInt & that.toInt)
    def |(that: BitSet): BitSet = BitSet(toInt | that.toInt)
    def ^(that: BitSet): BitSet = BitSet(toInt ^ that.toInt)
    def isOn(that: Int): Boolean = ((toInt >> that) & 1) == 1
    def +(value: Int): BitSet = BitSet(toInt | (1 << value))
    def -(value: Int): BitSet = BitSet(toInt & ~(1 << value))
    def isEmpty: Boolean = toInt == 0
  }
  case class Carriage(id: Index, speed: Speed)
  case class Schedule(plans: List[CarriagePlan], used: Set[(Time, Position)] = HashSet()) {
    def tryAdd(that: CarriagePlan): Option[Schedule] = {
      if (plans.exists(plan ⇒ (plan.carriage.id < that.carriage.id && plan.startTime >= that.startTime) || (plan.carriage.id > that.carriage.id && plan.startTime <= that.startTime))) None
      else plans.flatMap(that.cross).filter{case (_, position) ⇒ 0.toRational <= position && position < goal}.partition{case pair@(_, position) ⇒ !widePosition.contains(position) || used.contains(pair)} match {
        case (Nil, cp) ⇒ Some(Schedule(that::plans, used ++ cp))
        case _ ⇒ None
      }
    }
    def added(that: Carriage): List[Schedule] = {
      plans.flatMap(plan ⇒ plan.constraints(that).flatMap(tryAdd))
    }
    def lastTime: Time = plans.map(_.reachTime(goal)).max
  }
  object CarriagePlan {
    def apply(carriage: Carriage, time: Time, position: Position): CarriagePlan = {
      CarriagePlan(carriage, time - position / carriage.speed)
    }
  }
  case class CarriagePlan(carriage: Carriage, startTime: Time) {
    def constraints(other: Carriage): List[CarriagePlan] = {
      val res = if (carriage.id < other.id) {
        if (!cross(CarriagePlan(other, startTime + 1.toRational)).exists { case (_, position) ⇒ 0.toRational <= position && position < goal }) CarriagePlan(other, (startTime + 1.toRational)) :: widePosition.map { position ⇒ CarriagePlan(other, reachTime(position), position) }.filter(startTime < _.startTime).toList
        else widePosition.map { position ⇒ CarriagePlan(other, reachTime(position), position) }.filter(startTime < _.startTime).toList
      }
      else if (carriage.id > other.id) {
        if (!cross(CarriagePlan(other, startTime - 1.toRational)).exists{case (_, position) ⇒ 0.toRational <= position && position < goal}) CarriagePlan(other, (startTime - 1.toRational)) :: widePosition.map{position ⇒ CarriagePlan(other, reachTime(position), position)}.filter(_.startTime < startTime).toList
        else widePosition.map{position ⇒ CarriagePlan(other, reachTime(position), position)}.filter(_.startTime < startTime).toList
      }else ???
      res
    }
    def reachTime(position: Position): Time = {
      position / carriage.speed + startTime
    }
    def cross(other: CarriagePlan): Option[(Time, Position)] = {
      if (carriage.id < other.carriage.id) {
        if (carriage.speed < other.carriage.speed) Some((other.startTime - startTime) * carriage.speed / (other.carriage.speed - carriage.speed)).map(time ⇒ (other.startTime + time, time * other.carriage.speed))
        else None
      }else {
        if (other.carriage.speed < carriage.speed) Some((startTime - other.startTime) * other.carriage.speed / (carriage.speed - other.carriage.speed)).map(time ⇒ (startTime + time, time * carriage.speed))
        else None
      }
    }
  }

  def max[T: Ordering](values: T*): T = values.min
  implicit class Wrap[T](val value: T) extends AnyVal {
    def toRational(implicit ev: T ⇒ Long): Rational = Rational.fromLong(value)
    def pipe(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
  final class Rational private (val numerator: Long, val denominator: Long) {
    override def equals(obj: Any): Boolean = obj match {
      case r: Rational ⇒ numerator == r.numerator && denominator == r.denominator
      case _ ⇒ super.equals(obj)
    }
    override def hashCode(): Int = numerator.hashCode() ^ denominator.hashCode()
    override def toString: String = if (denominator == 1) numerator.toString else s"$numerator/$denominator"
  }
  implicit object Rational extends Fractional[Rational] {
    @tailrec private[this] def gcd(a: Long, b: Long): Long = b match {
      case 0 ⇒ a
      case _ ⇒ gcd(b, a % b)
    }
    def apply(numerator: Long, denominator: Long): Rational = {
      val g = gcd(numerator.abs, denominator.abs)
      new Rational(denominator.signum * numerator / g, denominator.abs / g)
    }
    def fromLong(x: Long): Rational = new Rational(x, 1)
    override def div(x: Rational, y: Rational): Rational = Rational(x.numerator * y.denominator, x.denominator * y.numerator)
    override def plus(x: Rational, y: Rational): Rational = Rational(x.numerator * y.denominator + x.denominator * y.numerator, x.denominator * y.denominator)
    override def minus(x: Rational, y: Rational): Rational = Rational(x.numerator * y.denominator - x.denominator * y.numerator, x.denominator * y.denominator)
    override def times(x: Rational, y: Rational): Rational = Rational(x.numerator * y.numerator, x.denominator * y.denominator)
    override def negate(x: Rational): Rational = new Rational(-x.numerator, x.denominator)
    override def fromInt(x: Int): Rational = new Rational(x, 1)
    override def toInt(x: Rational): Int = (x.numerator / x.denominator).toInt
    override def toLong(x: Rational): Long = (x.numerator / x.denominator).toLong
    override def toFloat(x: Rational): Float = toDouble(x).toFloat
    override def toDouble(x: Rational): Double = x.numerator.toDouble / x.denominator
    override def compare(x: Rational, y: Rational): Int = (x.numerator * y.denominator).compare(x.denominator * y.numerator)
  }
}
