#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, at, b, bt, f, l, ms, me;
  int mbs = 5 * 60, mbe = 0, cont = 0;
  char c;
  cin >> a >> at >> b >> bt;
  cin >> f >> c >> l;
  ms = f * 60 + l;
  me = ms + at;
  while (mbs < me) {
    if (mbs >= 1440) break;
    mbe = mbs + bt;
    if (mbe > ms) cont++;
    mbs += b;
  }
  cout << cont << "\n";
  return 0;
}
