#include<stdio.h>

int main(){
        int fh, fm, lh, lm, k;

        scanf("%d %d %d %d %d", &fh, &fm, &lh, &lm, &k);

        int minute;

        minite=(lh*60+lm)-(fh*60+fm)-k;

        printf("&d", minite);

        return 0;
}
