object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN, datM, datK) = readLine.split(" ").map(_.toInt)
    val datA = readLine.split(" ").map(_.toInt).toVector
    val datB = readLine.split(" ").map(_.toInt).toVector

    def readbook(books:Int, rest:Int, nextA:Int, nextB:Int) :Int = {
      if ((nextA == datN) && (nextB == datM)) books
      else {
        val readA =
          if ((nextA == datN) || (datA(nextA) > rest)) books
          else readbook((books + 1), (rest - datA(nextA)), (nextA + 1), nextB)
        val readB =
          if ((nextB == datM) || (datB(nextB) > rest)) books
          else readbook((books + 1), (rest - datB(nextB)), nextA, (nextB + 1))
        if (readA > readB) readA else readB
      }
    }
    val ans = readbook(0, datK, 0, 0)

    println(ans)
  }
}
