//IN THE NAMME OF GOD #include #include #include using namespace std; #define ll long long const int inf=1e9; int del=10513; long long int ans; string l,r,s; ifstream fin("a.txt"); int dis(string start,string deadline){ long long int first=0,second=0,num1=0,num2=0; for(int i=0;i<2;i++){ first*=10; first+=start[i]-'0'; second*=10; second+=deadline[i]-'0'; } first*=(ll)60*60;second*=(ll)60*60; first*=1000;second*=1000; num1+=first;num2+=second; first=0;second=0; for(int i=3;i<5;i++){ first*=10; first+=start[i]-'0'; second*=10; second+=deadline[i]-'0'; } first*=60000;second*=60000; num1+=first;num2+=second; first=0;second=0; for(int i=6;i<8;i++){ first*=10; first+=start[i]-'0'; second*=10; second+=deadline[i]-'0'; } first*=1000;second*=1000; num1+=first;num2+=second; first=0;second=0; for(int i=9;i<12;i++){ first*=10; first+=start[i]-'0'; second*=10; second+=deadline[i]-'0'; } num1+=first;num2+=second; return (abs(num2-num1)+1)%del;; } int main(){ fin>>s; for(int i=0;i<1076;i++){ fin>>l>>s>>r; while(1 && i<1075){ getline(fin,s); bool b=0; for(int j=0;j'9'){ b=1; break; } } if(!b && s.size()) break; } ans+=(dis(l,r))%del; ans%=del; } cout<