#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, ta, tb;
  cin >> a >> ta >> b >> tb;
  int t, m;
  char c;
  cin >> t >> c >> m;
  m += 60 * t;
  int cur = 5 * 60;
  int res = 0;
  while (cur < 24 * 60) {
    if (min(cur + tb, m + ta) > max(cur, m)) ++res;
    cur += b;
  }
  cout << res;
}
