'use strict';
function main(input) {
  let inputs = input.split(' ');
  console.log((inputs[2] * 60 + inputs[3] * 0) - (inputs[0] * 60 + inputs[1] * 0) - inputs[4]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));