#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = (long long)1000000007 * 1000000007;
const long double eps = 1e-11;
const long double pi = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int le = 300, ri = 1440;
  int a, ta, b, tb;
  cin >> a >> ta >> b >> tb;
  string u;
  cin >> u;
  int m = 60 * stoi(u.substr(0, 2)) + stoi(u.substr(3, 4));
  int l = m - tb;
  int r = m + ta;
  int now = 300;
  int c = 0;
  while (now < ri) {
    if (l < now && now < r) {
      c++;
    }
    now += b;
  }
  cout << c << endl;
  return 0;
}
