function Main(input){ 
    let arr = input.split(' ').map(Number);
    let min1 = arr[0] * 60 + arr[1];
    let min2 = arr[2] * 60 + arr[3];
    console.log(min2-min1- arr[4]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
