fun main(args: Array<String>) {
    val (h1,m1,h2,m2,k) = readLine()!!.split(' ').map(String::toLong)

    if (true) {
        println((h2-h1)*60 + (m2-m1) - k)
    } else {
        println("No")
    }
}