#include <stdio.h>
 
int main(){
  int H1,M1,H2,M2,K;
  int temp1,temp2;
  scanf("%d %d %d %d %d",&H1,&M1,&H2,&M2,&K);
  temp1 = H1 / 60 + M1;
  temp2 = H2 / 60 + M2;
  printf("&d",temp2 - temp1 - K);
  return 0;
}