#include <bits/stdc++.h>   using namespace std;   int main() {     int a, ta;     cin >> a >> ta;     int b, tb, h = 0, m = 0, num = 0;     int totmin;     cin >> b >> tb;     string s;     cin >> s;     for (int i = 0; i < 2; i++) {       h = h * 10 + (s[i] -  0 );     }     for (int i = 3; i < 5; i++) {       m = m * 10 + (s[i] -  0 );     }     totmin = h * 60 + m;     for (int i = 5 * 60; i <= 1439; i += b) {       if ((i <= totmin && i + tb > totmin) || (i >= totmin && i < totmin + ta))         num++;     }     cout << num;   }   