#include<stdio.h> int main(){ int a,b,c,d; scanf("%d%d",&a,&b); scanf("%d%d",&c,&d); printf("%d",(c-a)*60 + (d-b)); return 0; }