import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int n = koko.nextInt(); String[] be = new String[n]; String[] wak = new String[n]; int total=0; for(int i=0; i=0&&sm<0){ rsh=sh-1; rsm=(60-bedm)+wakem; }else if(sh<0&&sm>=0){ rsh=(24-bedh)+wakeh; rsm=sm; }else{ rsh=sh; rsm=sm; } total = total+(60*rsh)+rsm; } System.out.println(total); } }