#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int main(int argc, char *arv[]) {
  int h1, m1, h2, m2, k;
  struct tm tm1, tm2;
  time_t t1, t2;
  int r = 0;
  scanf("%d %d %d %d %d\n", &h1, &m1, &h2, &m2, &k);
  
  memset(&tm1, 0x00, sizeof(tm1));
  memset(&tm2, 0x00, sizeof(tm2));
  
  tm1.tm_year = 2000 - 1900;
  tm1.tm_mon = 0;
  tm1.tm_mday = 1;
  memcpy((void *)&tm2, (void *)&tm1, sizeof(tm1));
  
  tm1.tm_hour = h1;
  tm1.tm_min = m1;
  tm1.tm_sec = 0;
  t1 = mktime(&tm1);
  tm2.tm_hour = h2;
  tm2.tm_min = m2;
  tm2.tm_sec = 0;
  t2 = mktime(&tm2);
  
  t2 -= k * 60;
  
  if (t2 > t1) {
    r = (t2 - t1) / 60;
  }
  
  printf("%d\n", r);
  return(0);
}
