include<stdio.h>

include<stdlib.h>

main()
{int a,b,c,d,shicha;
scanf("%d%d",&a,&b);
scanf("%d%d",&c,&d);
shicha=c60+d-(a60+b);
printf("%d",shicha);
system("pause");
}