object Main {
  def main() = {
    val N = readLine.toInt
    val ss = readLine.toString
    val tt = readLine.toString

    def loop(s: String)(t: String): Int = {
      if (s == "") {
        if (t == "")
          ss.length + tt.length
        else
          loop(ss)(t.take(t.length-1))
      } else if (s == t)
        (ss.length - s.length) + tt.length - t.length + 1
      else loop(s.tail)(t)
    }
    if (ss == tt)
      println(ss.length)
    else
      println(loop(ss)(tt))
  }
}