import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val H1 = sc.next().toInt()
        val M1 = sc.next().toInt()
        val H2 = sc.next().toInt()
        val M2 = sc.next().toInt()
        val K = sc.next().toInt()
        val S = H1 * 60 + M1
        val E = H2 * 60 + M2
        pw.println(E - S - K)
    }
}
