#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
map<long long, long long> mp1;
long long a[20000000];
int main() {
  cin.sync_with_stdio(false);
  long long i, j, k, l, c, v, n, m, r, t;
  long long x1, x2, y1, y2, x3, x4, x5, x6;
  char sd;
  string s, s1, s2, s3, ss[10000];
  while (cin >> c >> v) {
    cin >> k >> l;
    cin >> n >> sd >> m;
    long long m1 = n * 60 + m;
    long long m2 = m1 + v;
    c = 0;
    for (i = 300; i < 24 * 60; i += k) {
      if (((i + l) > m1) && ((i) < m2)) c++;
    }
    cout << c;
  }
}
