   program nomuraA
      implicit none
      integer::H1,M1,H2,M2,K
      integer::difh,difm,totalmin
      
         read *, H1,M1,H2,M2,K
         difh=H2-H1
         difm=M2-M1
         totalmin=difh*60+difm
         print *, totalmin-K
         
   end program nomuraA