#include <bits/stdc++.h>   using namespace std;   int main(void) {     cin.tie(0);     ios_base::sync_with_stdio(false);     int a, ta, b, tb;     string t;     cin >> a >> ta >> b >> tb >> t;     int p =         600 * (t[0] -  0 ) + 60 * (t[1] -  0 ) + 10 * (t[3] -  0 ) + t[4] -  0 ;     int q = p + ta;     int ans = 0, i;     for (i = 300; i < 1440; i += b) {       if (p * (ta + tb) < ta * tb + p * tb + i * ta &&           ta * tb + p * tb + i * ta < q * (ta + tb))         ans++;     }     cout << ans << endl;     return 0;   }   