#include <bits/stdc++.h>
using namespace std;
long long int i, j, k, n, m, v[1600001], t, r, rasp, T;
int main() {
  ios::sync_with_stdio(false);
  cout.precision(10);
  cout << fixed;
  long long int n, a, b;
  cin >> n >> a >> b >> T;
  string s;
  cin >> s;
  for (i = 0; i < s.size(); ++i) {
    if (s[i] == 'h')
      v[i + 1] = a;
    else
      v[i + 1] = a + b;
  }
  for (i = 1; i <= n; ++i) v[i + n] = v[i];
  for (i = 1; i <= 2 * n; ++i) v[i] += v[i - 1];
  long long int st = n + 1, dr = n + 1;
  while (dr <= 2 * n && v[dr] - v[st - 1] + (dr - st + 1) - a <= T) ++dr;
  --dr;
  rasp = max(rasp, dr - st + 1);
  st = n + 1, dr = n + 1;
  while (st >= 1 && v[n + 1] - v[st - 1] + (n + 1 - st + 1) - a <= T) --st;
  ++st;
  rasp = max(rasp, dr - st + 1);
  ++dr;
  if (rasp > n) rasp = n;
  while (st <= n + 1) {
    if (dr <= 2 * n && v[dr] - v[st - 1] + min(n + 1 - st, dr - n - 1) * a +
                               (dr - st + 1) - a <=
                           T) {
      while (dr <= 2 * n && v[dr] - v[st - 1] +
                                    min(n + 1 - st, dr - n - 1) * a +
                                    (dr - st + 1) - a <=
                                T)
        ++dr;
      --dr;
      rasp = max(rasp, min(dr - st + 1, n));
    }
    ++st;
  }
  cout << rasp;
  return 0;
}
