#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, ta, b, tb;
  cin >> a >> ta >> b >> tb;
  string s;
  cin >> s;
  int h, m;
  h = (s[0] - '0') * 10 + s[1] - '0';
  m = (s[3] - '0') * 10 + s[4] - '0';
  int mst;
  mst = h * 60 + m;
  int mend = h * 60 + m + ta;
  int mb = 5 * 60;
  int count = 0;
  while (mb <= 1439 && mb < mend) {
    if (mb + tb > mst && mb < mend) {
      count++;
    }
    mb += b;
  }
  cout << count;
  return 0;
}
