#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, ta, b, tb;
  cin >> a >> ta >> b >> tb;
  string s;
  cin >> s;
  int x = (s[0] - '0') * 10 + s[1] - '0';
  int r = (x - 5) * 60 + (s[3] - '0') * 10 + s[4] - '0';
  int ans = 0;
  for (int i = 0; i <= 1139; i += b) {
    if (r + ta > i && r < i + tb) ans++;
  }
  cout << ans << endl;
}
