#include <bits/stdc++.h>
using namespace std;
template <class X>
void input(vector<X>& a, int N) {
  X temp;
  for (long long int i = 0; i < N; i++) {
    cin >> temp;
    a.push_back(temp);
  }
}
void solve() {
  long long int a, ta, b, tb;
  cin >> a >> ta >> b >> tb;
  long long int h, m1;
  char ch;
  cin >> h >> ch >> m1;
  m1 = h * 60 + m1;
  long long int m2 = m1 + ta;
  long long int ans = 0;
  for (int i = 0; i < 1140; i += b) {
    long long int cur1 = 300 + i;
    long long int cur2 = 300 + i + tb;
    if (!(cur1 >= m2 || m1 >= cur2)) {
      ans++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
